diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-05-19 10:33:21 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-05-19 10:33:21 +0300 |
commit | 36a59d088eca61b834191dacea009677a96c052f (patch) | |
tree | e4f33972dab5d8ef79e3944a9f403035fceea43f /app/models/incident_management | |
parent | a1761f15ec2cae7c7f7bbda39a75494add0dfd6f (diff) |
Add latest changes from gitlab-org/gitlab@15-0-stable-eev15.0.0-rc42
Diffstat (limited to 'app/models/incident_management')
-rw-r--r-- | app/models/incident_management/timeline_event.rb | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/app/models/incident_management/timeline_event.rb b/app/models/incident_management/timeline_event.rb new file mode 100644 index 00000000000..d30d6906e14 --- /dev/null +++ b/app/models/incident_management/timeline_event.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +module IncidentManagement + class TimelineEvent < ApplicationRecord + include CacheMarkdownField + + self.table_name = 'incident_management_timeline_events' + + cache_markdown_field :note, + pipeline: :'incident_management/timeline_event', + issuable_reference_expansion_enabled: true + + belongs_to :project + belongs_to :author, class_name: 'User', foreign_key: :author_id + belongs_to :incident, class_name: 'Issue', foreign_key: :issue_id, inverse_of: :incident_management_timeline_events + belongs_to :updated_by_user, class_name: 'User', foreign_key: :updated_by_user_id + belongs_to :promoted_from_note, class_name: 'Note', foreign_key: :promoted_from_note_id + + validates :project, :incident, :occurred_at, presence: true + validates :action, presence: true, length: { maximum: 128 } + validates :note, :note_html, presence: true, length: { maximum: 10_000 } + + scope :order_occurred_at_asc, -> { reorder(occurred_at: :asc) } + end +end |