Return only labels that user have access on IssuableFinder#labels

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