Hide archived project labels from group issue tracker

This commit is contained in:
Horacio Bertorello 2017-06-29 02:23:38 -03:00
parent a704f9e580
commit 3900b2f378
3 changed files with 13 additions and 4 deletions

View File

@ -83,7 +83,12 @@ class LabelsFinder < UnionFinder
def projects
return @projects if defined?(@projects)
@projects = skip_authorization ? Project.all : ProjectsFinder.new(current_user: current_user).execute
@projects = if skip_authorization
Project.all
else
ProjectsFinder.new(params: { non_archived: true }, current_user: current_user).execute
end
@projects = @projects.in_namespace(params[:group_id]) if group?
@projects = @projects.where(id: params[:project_ids]) if projects?
@projects = @projects.reorder(nil)

View File

@ -0,0 +1,4 @@
---
title: Hide archived project labels from group issue tracker
merge_request: 12547
author: Horacio Bertorello

View File

@ -49,12 +49,12 @@ describe LabelsFinder do
end
context 'filtering by group_id' do
it 'returns labels available for any project within the group' do
it 'returns labels available for any non-archived project within the group' do
group_1.add_developer(user)
project_1.archive!
finder = described_class.new(user, group_id: group_1.id)
expect(finder.execute).to eq [group_label_2, project_label_1, group_label_1, project_label_5]
expect(finder.execute).to eq [group_label_2, group_label_1, project_label_5]
end
end