Return only labels that user have access on IssuableFinder#labels

parent 530aae90
...@@ -124,14 +124,11 @@ class IssuableFinder ...@@ -124,14 +124,11 @@ class IssuableFinder
def labels def labels
return @labels if defined?(@labels) return @labels if defined?(@labels)
@labels =
if labels? && !filter_by_no_label? if labels? && !filter_by_no_label?
@labels = Label.where(title: label_names) LabelsFinder.new(current_user, project_ids: projects, title: label_names).execute
if projects
@labels = LabelsFinder.new(current_user, project_ids: projects, title: label_names).execute
end
else else
@labels = Label.none Label.none
end end
end end
......
...@@ -45,7 +45,7 @@ class LabelsFinder < UnionFinder ...@@ -45,7 +45,7 @@ class LabelsFinder < UnionFinder
params[:project_id].presence params[:project_id].presence
end end
def project_ids def projects_ids
params[:project_ids].presence params[:project_ids].presence
end end
...@@ -70,7 +70,7 @@ class LabelsFinder < UnionFinder ...@@ -70,7 +70,7 @@ class LabelsFinder < UnionFinder
@projects = available_projects @projects = available_projects
@projects = @projects.in_namespace(group_id) if group_id @projects = @projects.in_namespace(group_id) if group_id
@projects = @projects.where(id: project_ids) if project_ids @projects = @projects.where(id: projects_ids) if projects_ids
@projects = @projects.reorder(nil) @projects = @projects.reorder(nil)
@projects @projects
......
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