Commit 4c6859a2 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Prevent duplicates in issue finder when filter by label

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent 048a2197
......@@ -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
......
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