diff options
author | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2016-09-29 15:50:14 -0300 |
---|---|---|
committer | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2016-10-19 14:58:25 -0200 |
commit | 3db2261005c438faad8bf4a339d46eb7798f05b5 (patch) | |
tree | b09acae73956cf67ed160a3ae2c4139a9140921a /lib/banzai | |
parent | 723e576782aefa339a4db8916908c7ebe5a92f48 (diff) | |
download | gitlab-ce-3db2261005c438faad8bf4a339d46eb7798f05b5.tar.gz |
Reuse LabelsFinder on Banzai::Filter::LabelReferenceFilter
Diffstat (limited to 'lib/banzai')
-rw-r--r-- | lib/banzai/filter/label_reference_filter.rb | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/lib/banzai/filter/label_reference_filter.rb b/lib/banzai/filter/label_reference_filter.rb index 649c697b415..2ce33aa1d15 100644 --- a/lib/banzai/filter/label_reference_filter.rb +++ b/lib/banzai/filter/label_reference_filter.rb @@ -39,13 +39,7 @@ module Banzai end def find_labels(project) - label_ids = [] - label_ids << project.group.labels.select(:id) if project.group.present? - label_ids << project.labels.select(:id) - - union = Gitlab::SQL::Union.new(label_ids) - - object_class.where("labels.id IN (#{union.to_sql})") + LabelsFinder.new(user, project_id: project.id).execute end # Parameters to pass to `Label.find_by` based on the given arguments @@ -91,6 +85,10 @@ module Banzai object.is_a?(ProjectLabel) && object.project == project end + def user + context[:current_user] || context[:author] + end + def project context[:project] end |