Skip authorization check when searching for labels on IssuableFinder

This commit is contained in:
Douglas Barbosa Alexandre 2016-10-28 00:50:38 -02:00
parent bc7895fff8
commit adb8b82858
2 changed files with 3 additions and 3 deletions

View file

@ -126,7 +126,7 @@ class IssuableFinder
@labels = @labels =
if labels? && !filter_by_no_label? if labels? && !filter_by_no_label?
LabelsFinder.new(current_user, project_ids: projects, title: label_names).execute LabelsFinder.new(current_user, project_ids: projects, title: label_names).execute(skip_authorization: true)
else else
Label.none Label.none
end end
@ -273,7 +273,7 @@ class IssuableFinder
items = items.with_label(label_names, params[:sort]) items = items.with_label(label_names, params[:sort])
if projects if projects
label_ids = LabelsFinder.new(current_user, project_ids: projects).execute.select(:id) label_ids = LabelsFinder.new(current_user, project_ids: projects).execute(skip_authorization: true).select(:id)
items = items.where(labels: { id: label_ids }) items = items.where(labels: { id: label_ids })
end end
end end

View file

@ -22,7 +22,7 @@ class LabelsFinder < UnionFinder
label_ids << project.group.labels if project.group.present? label_ids << project.group.labels if project.group.present?
label_ids << project.labels label_ids << project.labels
else else
label_ids << Label.where(group_id: projects.group_ids.uniq) label_ids << Label.where(group_id: projects.group_ids)
label_ids << Label.where(project_id: projects.select(:id)) label_ids << Label.where(project_id: projects.select(:id))
end end