diff options
author | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2016-09-20 01:08:04 -0300 |
---|---|---|
committer | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2016-10-19 14:58:24 -0200 |
commit | cf14482a5aceb62c178c19cc70e9354dc23dd9e1 (patch) | |
tree | 75a7aaf9030657c33669eee6188cbea98791f924 /app/finders | |
parent | 476c26deb22a6e958dc3251e9771560b058a34a3 (diff) | |
download | gitlab-ce-cf14482a5aceb62c178c19cc70e9354dc23dd9e1.tar.gz |
LabelsFinder inherits from UnionFinder
Diffstat (limited to 'app/finders')
-rw-r--r-- | app/finders/labels_finder.rb | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/app/finders/labels_finder.rb b/app/finders/labels_finder.rb index cf7018cf8a2..a27ff56309b 100644 --- a/app/finders/labels_finder.rb +++ b/app/finders/labels_finder.rb @@ -1,11 +1,11 @@ -class LabelsFinder +class LabelsFinder < UnionFinder def initialize(current_user, params = {}) @current_user = current_user @params = params end def execute - items = init_collection + items = find_union(label_ids, Label) items = with_title(items) sort(items) end @@ -14,15 +14,10 @@ class LabelsFinder attr_reader :current_user, :params - def init_collection + def label_ids label_ids = [] label_ids << Label.where(group_id: projects.where.not(group: nil).select(:namespace_id)).select(:id) - label_ids << Label.where(project_id: projects).select(:id) - - union = Gitlab::SQL::Union.new(label_ids) - - Label.where("labels.id IN (#{union.to_sql})") - .reorder(title: :asc) + label_ids << Label.where(project_id: projects.select(:id)).select(:id) end def with_title(items) |