2017-03-15 13:18:44 +00:00
|
|
|
class SystemNoteMetadata < ActiveRecord::Base
|
2017-11-16 14:23:32 +00: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 18:00:35 +00:00
|
|
|
commit cross_reference
|
|
|
|
close duplicate
|
2017-11-16 16:03:15 +00:00
|
|
|
].freeze
|
2017-11-16 14:23:32 +00:00
|
|
|
|
2017-03-15 13:18:44 +00:00
|
|
|
ICON_TYPES = %w[
|
2017-04-28 23:54:37 +00:00
|
|
|
commit description merge confidential visible label assignee cross_reference
|
2017-04-05 02:31:48 +00:00
|
|
|
title time_tracking branch milestone discussion task moved
|
2017-08-30 14:57:50 +00:00
|
|
|
opened closed merged duplicate locked unlocked
|
2017-04-05 02:31:48 +00:00
|
|
|
outdated
|
2017-03-15 13:18:44 +00:00
|
|
|
].freeze
|
|
|
|
|
|
|
|
validates :note, presence: true
|
2018-05-02 21:34:05 +00:00
|
|
|
validates :action, inclusion: { in: :icon_types }, allow_nil: true
|
2017-03-15 13:18:44 +00:00
|
|
|
|
|
|
|
belongs_to :note
|
2018-05-02 21:34:05 +00:00
|
|
|
|
|
|
|
def icon_types
|
|
|
|
ICON_TYPES
|
|
|
|
end
|
2017-03-15 13:18:44 +00:00
|
|
|
end
|