gitlab-org--gitlab-foss/app/models/system_note_metadata.rb

35 lines
984 B
Ruby
Raw Normal View History

# frozen_string_literal: true
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
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[
commit description merge confidential visible label assignee cross_reference
title time_tracking branch milestone discussion task moved
opened closed merged duplicate locked unlocked
outdated tag due_date pinned_embed
2017-03-15 09:18:44 -04:00
].freeze
validates :note, presence: true
validates :action, inclusion: { in: :icon_types }, allow_nil: true
2017-03-15 09:18:44 -04:00
belongs_to :note
def icon_types
ICON_TYPES
end
def cross_reference_types
TYPES_WITH_CROSS_REFERENCES
end
2017-03-15 09:18:44 -04:00
end