Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-07-30 14:26:23 +0400
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-07-30 14:26:23 +0400
commit4c6859a2dee6da420f33c3b7f9946f3642eb85f7 (patch)
tree1c62fed89f5b46b95677a18c6326b433f4da3832 /app/finders
parent048a21974ef56285099eb4b54b6ca1e6fd7e3e8c (diff)
Prevent duplicates in issue finder when filter by label
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'app/finders')
-rw-r--r--app/finders/base_finder.rb8
1 files changed, 7 insertions, 1 deletions
diff --git a/app/finders/base_finder.rb b/app/finders/base_finder.rb
index ad63135e7e6..ec5f5919d7e 100644
--- a/app/finders/base_finder.rb
+++ b/app/finders/base_finder.rb
@@ -125,7 +125,13 @@ class BaseFinder
def by_label(items)
if params[:label_name].present?
- items = items.joins(:labels).where("labels.title in (?)", params[:label_name].split(","))
+ label_names = params[:label_name].split(",")
+
+ item_ids = LabelLink.joins(:label).
+ where('labels.title in (?)', label_names).
+ where(target_type: klass.name).pluck(:target_id)
+
+ items = items.where(id: item_ids)
end
items