diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-09-20 16:18:24 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-09-20 16:18:24 +0300 |
commit | 0653e08efd039a5905f3fa4f6e9cef9f5d2f799c (patch) | |
tree | 4dcc884cf6d81db44adae4aa99f8ec1233a41f55 /app/models/concerns/issuable.rb | |
parent | 744144d28e3e7fddc117924fef88de5d9674fe4c (diff) |
Add latest changes from gitlab-org/gitlab@14-3-stable-eev14.3.0-rc42
Diffstat (limited to 'app/models/concerns/issuable.rb')
-rw-r--r-- | app/models/concerns/issuable.rb | 17 |
1 files changed, 3 insertions, 14 deletions
diff --git a/app/models/concerns/issuable.rb b/app/models/concerns/issuable.rb index 8d0f8b01d64..5c307158a9a 100644 --- a/app/models/concerns/issuable.rb +++ b/app/models/concerns/issuable.rb @@ -26,6 +26,7 @@ module Issuable include UpdatedAtFilterable include ClosedAtFilterable include VersionedDescription + include SortableTitle TITLE_LENGTH_MAX = 255 TITLE_HTML_LENGTH_MAX = 800 @@ -116,20 +117,6 @@ module Issuable end # rubocop:enable GitlabSecurity/SqlInjection - scope :without_particular_labels, ->(label_names) do - labels_table = Label.arel_table - label_links_table = LabelLink.arel_table - issuables_table = klass.arel_table - inner_query = label_links_table.project('true') - .join(labels_table, Arel::Nodes::InnerJoin).on(labels_table[:id].eq(label_links_table[:label_id])) - .where(label_links_table[:target_type].eq(name) - .and(label_links_table[:target_id].eq(issuables_table[:id])) - .and(labels_table[:title].in(label_names))) - .exists.not - - where(inner_query) - end - 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 :join_project, -> { joins(:project) } @@ -293,6 +280,8 @@ module Issuable when 'popularity', 'popularity_desc', 'upvotes_desc' then order_upvotes_desc when 'priority', 'priority_asc' then order_due_date_and_labels_priority(excluded_labels: excluded_labels) when 'priority_desc' then order_due_date_and_labels_priority('DESC', excluded_labels: excluded_labels) + when 'title_asc' then order_title_asc.with_order_id_desc + when 'title_desc' then order_title_desc.with_order_id_desc else order_by(method) end |