2018-07-25 05:30:33 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2019-03-28 09:17:42 -04:00
|
|
|
class SystemNoteMetadata < ApplicationRecord
|
2020-11-23 16:09:19 -05:00
|
|
|
include Importable
|
|
|
|
|
2017-11-16 09:23:32 -05:00
|
|
|
# These notes's action text might contain a reference that is external.
|
|
|
|
# We should always force a deep validation upon references that are found
|
|
|
|
# in this note type.
|
|
|
|
# Other notes can always be safely shown as all its references are
|
|
|
|
# in the same project (i.e. with the same permissions)
|
|
|
|
TYPES_WITH_CROSS_REFERENCES = %w[
|
2017-11-20 13:00:35 -05:00
|
|
|
commit cross_reference
|
|
|
|
close duplicate
|
2019-08-12 08:07:15 -04:00
|
|
|
moved merge
|
2019-09-20 09:23:21 -04:00
|
|
|
label milestone
|
2020-08-20 20:10:44 -04:00
|
|
|
relate unrelate
|
2020-12-03 16:09:35 -05:00
|
|
|
cloned
|
2017-11-16 11:03:15 -05:00
|
|
|
].freeze
|
2017-11-16 09:23:32 -05:00
|
|
|
|
2017-03-15 09:18:44 -04:00
|
|
|
ICON_TYPES = %w[
|
2017-04-28 19:54:37 -04:00
|
|
|
commit description merge confidential visible label assignee cross_reference
|
2020-05-07 08:09:46 -04:00
|
|
|
designs_added designs_modified designs_removed designs_discussion_added
|
2020-12-03 16:09:35 -05:00
|
|
|
title time_tracking branch milestone discussion task moved cloned
|
2020-09-24 05:09:35 -04:00
|
|
|
opened closed merged duplicate locked unlocked outdated reviewer
|
2020-07-07 08:09:16 -04:00
|
|
|
tag due_date pinned_embed cherry_pick health_status approved unapproved
|
2020-09-21 17:09:27 -04:00
|
|
|
status alert_issue_added relate unrelate new_alert_added severity
|
2017-03-15 09:18:44 -04:00
|
|
|
].freeze
|
|
|
|
|
2020-11-23 16:09:19 -05:00
|
|
|
validates :note, presence: true, unless: :importing?
|
2018-05-02 17:34:05 -04:00
|
|
|
validates :action, inclusion: { in: :icon_types }, allow_nil: true
|
2017-03-15 09:18:44 -04:00
|
|
|
|
|
|
|
belongs_to :note
|
2019-10-18 07:11:44 -04:00
|
|
|
belongs_to :description_version
|
2018-05-02 17:34:05 -04:00
|
|
|
|
|
|
|
def icon_types
|
|
|
|
ICON_TYPES
|
|
|
|
end
|
2018-09-27 14:58:23 -04:00
|
|
|
|
|
|
|
def cross_reference_types
|
|
|
|
TYPES_WITH_CROSS_REFERENCES
|
|
|
|
end
|
2017-03-15 09:18:44 -04:00
|
|
|
end
|
2019-09-13 09:26:31 -04:00
|
|
|
|
|
|
|
SystemNoteMetadata.prepend_if_ee('EE::SystemNoteMetadata')
|