diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-05-26 12:08:06 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-05-26 12:08:06 +0300 |
commit | 27c6c4bf061c3a2289ce4808b1b354535994d09d (patch) | |
tree | e973f10e40356141a4f19b94259b3b2f2b93b792 /app/models/concerns/issuable.rb | |
parent | 47a2a65f346719a0b4441a28a7adcbe747173f30 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models/concerns/issuable.rb')
-rw-r--r-- | app/models/concerns/issuable.rb | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/app/models/concerns/issuable.rb b/app/models/concerns/issuable.rb index a1b14dca4ac..1407a380978 100644 --- a/app/models/concerns/issuable.rb +++ b/app/models/concerns/issuable.rb @@ -139,7 +139,6 @@ module Issuable scope :without_label, -> { joins("LEFT OUTER JOIN label_links ON label_links.target_type = '#{name}' AND label_links.target_id = #{table_name}.id").where(label_links: { id: nil }) } scope :with_label_ids, ->(label_ids) { joins(:label_links).where(label_links: { label_id: label_ids }) } - scope :any_label, -> { joins(:label_links).distinct } scope :join_project, -> { joins(:project) } scope :inc_notes_with_associations, -> { includes(notes: [:project, :author, :award_emoji]) } scope :references_project, -> { references(:project) } @@ -316,6 +315,14 @@ module Issuable end end + def any_label(sort = nil) + if sort + joins(:label_links).group(*grouping_columns(sort)) + else + joins(:label_links).distinct + end + end + # Includes table keys in group by clause when sorting # preventing errors in postgres # |