2018-07-25 05:30:33 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2019-03-28 09:17:42 -04:00
|
|
|
class SystemNoteMetadata < ApplicationRecord
|
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
|
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
|
2017-04-04 22:31:48 -04:00
|
|
|
title time_tracking branch milestone discussion task moved
|
2020-03-31 20:08:09 -04:00
|
|
|
opened closed merged duplicate locked unlocked outdated
|
|
|
|
tag due_date pinned_embed cherry_pick health_status
|
2017-03-15 09:18:44 -04:00
|
|
|
].freeze
|
|
|
|
|
|
|
|
validates :note, presence: true
|
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')
|