Return only labels that user have access on IssuableFinder#labels

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