diff options
author | Rubén Dávila <rdavila84@gmail.com> | 2016-02-25 21:57:28 -0500 |
---|---|---|
committer | Rubén Dávila <rdavila84@gmail.com> | 2016-03-02 12:51:29 -0500 |
commit | 0b86b46a2c0eeaa397d2dccb49bf51d096ac12c6 (patch) | |
tree | 79beec1803df5116f0759383e42158dcc0899b2a | |
parent | 6aa50165b0acc355925e271f07ef8e87291e0232 (diff) | |
download | gitlab-ce-0b86b46a2c0eeaa397d2dccb49bf51d096ac12c6.tar.gz |
Don't list issues from archived projects in Group view.
-rw-r--r-- | app/controllers/concerns/issues_action.rb | 2 | ||||
-rw-r--r-- | app/models/concerns/issuable.rb | 1 | ||||
-rw-r--r-- | app/models/project.rb | 2 | ||||
-rw-r--r-- | features/groups.feature | 6 | ||||
-rw-r--r-- | features/steps/groups.rb | 15 |
5 files changed, 23 insertions, 3 deletions
diff --git a/app/controllers/concerns/issues_action.rb b/app/controllers/concerns/issues_action.rb index 5b098628557..ef8e74a4641 100644 --- a/app/controllers/concerns/issues_action.rb +++ b/app/controllers/concerns/issues_action.rb @@ -2,7 +2,7 @@ module IssuesAction extend ActiveSupport::Concern def issues - @issues = get_issues_collection + @issues = get_issues_collection.non_archived @issues = @issues.page(params[:page]).per(ApplicationController::PER_PAGE) @issues = @issues.preload(:author, :project) diff --git a/app/models/concerns/issuable.rb b/app/models/concerns/issuable.rb index e5f089fb8a0..286d6655861 100644 --- a/app/models/concerns/issuable.rb +++ b/app/models/concerns/issuable.rb @@ -38,6 +38,7 @@ module Issuable scope :join_project, -> { joins(:project) } scope :references_project, -> { references(:project) } + scope :non_archived, -> { join_project.merge(Project.non_archived) } delegate :name, :email, diff --git a/app/models/project.rb b/app/models/project.rb index 6f5d592755a..b9810c9cda4 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -278,7 +278,7 @@ class Project < ActiveRecord::Base end def search_by_title(query) - where('projects.archived = ?', false).where('LOWER(projects.name) LIKE :query', query: "%#{query.downcase}%") + non_archived.where('LOWER(projects.name) LIKE :query', query: "%#{query.downcase}%") end def find_with_namespace(id) diff --git a/features/groups.feature b/features/groups.feature index 55fffb012ae..4f9c28f813c 100644 --- a/features/groups.feature +++ b/features/groups.feature @@ -22,6 +22,12 @@ Feature: Groups When I visit group "Owned" issues page Then I should see issues from group "Owned" assigned to me + Scenario: I should not see issues from archived project in "Owned" group issues list + Given Group "Owned" has archived project + And the archived project have some issues + When I visit group "Owned" issues page + Then I should not see issues from the archived project + Scenario: I should see group "Owned" merge requests list Given project from group "Owned" has merge requests assigned to me When I visit group "Owned" merge requests page diff --git a/features/steps/groups.rb b/features/steps/groups.rb index 1e2a78a6029..b0ec402531b 100644 --- a/features/steps/groups.rb +++ b/features/steps/groups.rb @@ -44,6 +44,12 @@ class Spinach::Features::Groups < Spinach::FeatureSteps end end + step 'I should not see issues from the archived project' do + @archived_project.issues.each do |issue| + expect(page).not_to have_content issue.title + end + end + step 'I should see merge requests from group "Owned" assigned to me' do assigned_to_me(:merge_requests).each do |issue| expect(page).to have_content issue.title[0..80] @@ -113,7 +119,7 @@ class Spinach::Features::Groups < Spinach::FeatureSteps step 'Group "Owned" has archived project' do group = Group.find_by(name: 'Owned') - create(:project, namespace: group, archived: true, path: "archived-project") + @archived_project = create(:project, namespace: group, archived: true, path: "archived-project") end step 'I should see "archived" label' do @@ -124,6 +130,13 @@ class Spinach::Features::Groups < Spinach::FeatureSteps visit group_path(-1) end + step 'the archived project have some issues' do + create :issue, + project: @archived_project, + assignee: current_user, + author: current_user + end + private def assigned_to_me(key) |