diff options
Diffstat (limited to 'app/models/concerns/issuable.rb')
-rw-r--r-- | app/models/concerns/issuable.rb | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/app/models/concerns/issuable.rb b/app/models/concerns/issuable.rb index a1b14dca4ac..220af8ab7c7 100644 --- a/app/models/concerns/issuable.rb +++ b/app/models/concerns/issuable.rb @@ -39,15 +39,6 @@ module Issuable locked: 4 }.with_indifferent_access.freeze - # This object is used to gather issuable meta data for displaying - # upvotes, downvotes, notes and closing merge requests count for issues and merge requests - # lists avoiding n+1 queries and improving performance. - IssuableMeta = Struct.new(:upvotes, :downvotes, :user_notes_count, :mrs_count) do - def merge_requests_count(user = nil) - mrs_count - end - end - included do cache_markdown_field :title, pipeline: :single_line cache_markdown_field :description, issuable_state_filter_enabled: true @@ -139,7 +130,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) } @@ -185,6 +175,10 @@ module Issuable assignees.count > 1 end + def supports_weight? + false + end + private def description_max_length_for_new_records_is_valid @@ -201,7 +195,7 @@ module Issuable class_methods do # Searches for records with a matching title. # - # This method uses ILIKE on PostgreSQL and LIKE on MySQL. + # This method uses ILIKE on PostgreSQL. # # query - The search query as a String # @@ -225,7 +219,7 @@ module Issuable # Searches for records with a matching title or description. # - # This method uses ILIKE on PostgreSQL and LIKE on MySQL. + # This method uses ILIKE on PostgreSQL. # # query - The search query as a String # matched_columns - Modify the scope of the query. 'title', 'description' or joining them with a comma. @@ -316,6 +310,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 # @@ -401,6 +403,10 @@ module Issuable participants(user).include?(user) end + def can_assign_epic?(user) + false + end + def to_hook_data(user, old_associations: {}) changes = previous_changes |