Commit 47e9db8b authored by Sean McGivern's avatar Sean McGivern

Merge branch 'hb-hide-archived-labels-from-group-issue-tracker' into 'master'

Hide archived project labels from the group issue tracker

Closes #26389

See merge request !12547
parents f8973d76 3900b2f3
...@@ -83,7 +83,12 @@ class LabelsFinder < UnionFinder ...@@ -83,7 +83,12 @@ class LabelsFinder < UnionFinder
def projects def projects
return @projects if defined?(@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.in_namespace(params[:group_id]) if group?
@projects = @projects.where(id: params[:project_ids]) if projects? @projects = @projects.where(id: params[:project_ids]) if projects?
@projects = @projects.reorder(nil) @projects = @projects.reorder(nil)
......
---
title: Hide archived project labels from group issue tracker
merge_request: 12547
author: Horacio Bertorello
...@@ -49,12 +49,12 @@ describe LabelsFinder do ...@@ -49,12 +49,12 @@ describe LabelsFinder do
end end
context 'filtering by group_id' do 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) group_1.add_developer(user)
project_1.archive!
finder = described_class.new(user, group_id: group_1.id) 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
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment