diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-05-17 19:05:49 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-05-17 19:05:49 +0300 |
commit | 43a25d93ebdabea52f99b05e15b06250cd8f07d7 (patch) | |
tree | dceebdc68925362117480a5d672bcff122fb625b /app/models/concerns/issuable.rb | |
parent | 20c84b99005abd1c82101dfeff264ac50d2df211 (diff) |
Add latest changes from gitlab-org/gitlab@16-0-stable-eev16.0.0-rc42
Diffstat (limited to 'app/models/concerns/issuable.rb')
-rw-r--r-- | app/models/concerns/issuable.rb | 39 |
1 files changed, 22 insertions, 17 deletions
diff --git a/app/models/concerns/issuable.rb b/app/models/concerns/issuable.rb index 50696c7b5e1..b1ec6b8ba32 100644 --- a/app/models/concerns/issuable.rb +++ b/app/models/concerns/issuable.rb @@ -84,11 +84,11 @@ module Issuable has_one :metrics, inverse_of: model_name.singular.to_sym, autosave: true delegate :name, - :email, - :public_email, - to: :author, - allow_nil: true, - prefix: true + :email, + :public_email, + to: :author, + allow_nil: true, + prefix: true validates :author, presence: true validates :title, presence: true, length: { maximum: TITLE_LENGTH_MAX } @@ -174,6 +174,10 @@ module Issuable end end + def issuable_type + self.class.name.underscore + end + # We want to use optimistic lock for cases when only title or description are involved # http://api.rubyonrails.org/classes/ActiveRecord/Locking/Optimistic.html def locking_enabled? @@ -197,15 +201,15 @@ module Issuable end def supports_severity? - incident? + incident_type_issue? end def supports_escalation? - incident? + incident_type_issue? end - def incident? - is_a?(Issue) && super + def incident_type_issue? + is_a?(Issue) && work_item_type&.incident? end def supports_issue_type? @@ -345,8 +349,7 @@ module Issuable order_milestone_due_asc .order_labels_priority(excluded_labels: excluded_labels, extra_select_columns: [milestones_due_date]) - .reorder(milestones_due_date_with_direction.nulls_last, - highest_priority_arel_with_direction.nulls_last) + .reorder(milestones_due_date_with_direction.nulls_last, highest_priority_arel_with_direction.nulls_last) end def order_labels_priority(direction = 'ASC', excluded_labels: [], extra_select_columns: [], with_cte: false) @@ -620,8 +623,10 @@ module Issuable end def updated_tasks - Taskable.get_updated_tasks(old_content: previous_changes['description'].first, - new_content: description) + Taskable.get_updated_tasks( + old_content: previous_changes['description'].first, + new_content: description + ) end ## @@ -640,10 +645,6 @@ module Issuable false end - def ensure_metrics - self.metrics || create_metrics - end - ## # Overridden in MergeRequest # @@ -658,6 +659,10 @@ module Issuable { name: name, subject: self } end + + def supports_health_status? + false + end end Issuable.prepend_mod_with('Issuable') |