diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-11-17 14:33:21 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-11-17 14:33:21 +0300 |
commit | 7021455bd1ed7b125c55eb1b33c5a01f2bc55ee0 (patch) | |
tree | 5bdc2229f5198d516781f8d24eace62fc7e589e9 /app/models/incident_management | |
parent | 185b095e93520f96e9cfc31d9c3e69b498cdab7c (diff) |
Add latest changes from gitlab-org/gitlab@15-6-stable-eev15.6.0-rc42
Diffstat (limited to 'app/models/incident_management')
-rw-r--r-- | app/models/incident_management/timeline_event.rb | 2 | ||||
-rw-r--r-- | app/models/incident_management/timeline_event_tag.rb | 11 |
2 files changed, 12 insertions, 1 deletions
diff --git a/app/models/incident_management/timeline_event.rb b/app/models/incident_management/timeline_event.rb index 735d4e4298c..e70209f1538 100644 --- a/app/models/incident_management/timeline_event.rb +++ b/app/models/incident_management/timeline_event.rb @@ -18,6 +18,8 @@ module IncidentManagement validates :project, :incident, :occurred_at, presence: true validates :action, presence: true, length: { maximum: 128 } + # `user_input` is a note filled in by a user via API. Not auto generated by GitLab + validates :note, presence: true, length: { maximum: 280 }, on: :user_input validates :note, presence: true, length: { maximum: 10_000 } validates :note_html, length: { maximum: 10_000 } diff --git a/app/models/incident_management/timeline_event_tag.rb b/app/models/incident_management/timeline_event_tag.rb index cde3afcaa16..d1e3fbc2a6a 100644 --- a/app/models/incident_management/timeline_event_tag.rb +++ b/app/models/incident_management/timeline_event_tag.rb @@ -4,6 +4,9 @@ module IncidentManagement class TimelineEventTag < ApplicationRecord self.table_name = 'incident_management_timeline_event_tags' + START_TIME_TAG_NAME = 'Start time' + END_TIME_TAG_NAME = 'End time' + belongs_to :project, inverse_of: :incident_management_timeline_event_tags has_many :timeline_event_tag_links, @@ -14,7 +17,13 @@ module IncidentManagement through: :timeline_event_tag_links validates :name, presence: true, format: { with: /\A[^,]+\z/ } - validates :name, uniqueness: { scope: :project_id } + validates :name, uniqueness: { scope: :project_id, case_sensitive: false } validates :name, length: { maximum: 255 } + + scope :by_names, -> (tag_names) { where('lower(name) in (?)', tag_names.map(&:downcase)) } + + def self.pluck_names + pluck(:name) + end end end |