debian-mirror-gitlab/app/models/system_note_metadata.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

55 lines
1.7 KiB
Ruby
Raw Normal View History

2018-11-18 11:00:15 +05:30
# frozen_string_literal: true
2019-07-07 11:18:12 +05:30
class SystemNoteMetadata < ApplicationRecord
2021-02-22 17:27:13 +05:30
include Importable
2023-04-23 21:23:45 +05:30
include IgnorableColumns
ignore_column :note_id_convert_to_bigint, remove_with: '16.0', remove_after: '2023-05-22'
2021-02-22 17:27:13 +05:30
2018-03-17 18:26:18 +05:30
# 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[
commit cross_reference
2022-02-05 19:09:49 +05:30
closed duplicate
2019-09-04 21:01:54 +05:30
moved merge
2019-10-31 01:37:42 +05:30
label milestone
2020-11-24 15:15:51 +05:30
relate unrelate
2021-02-22 17:27:13 +05:30
cloned
2018-03-17 18:26:18 +05:30
].freeze
2017-08-17 22:00:37 +05:30
ICON_TYPES = %w[
commit description merge confidential visible label assignee cross_reference
2020-05-24 23:13:21 +05:30
designs_added designs_modified designs_removed designs_discussion_added
2021-02-22 17:27:13 +05:30
title time_tracking branch milestone discussion task moved cloned
2021-01-03 14:25:43 +05:30
opened closed merged duplicate locked unlocked outdated reviewer
2022-08-27 11:52:29 +05:30
tag due_date start_date_or_due_date pinned_embed cherry_pick health_status approved unapproved
2023-05-27 22:25:52 +05:30
status alert_issue_added relate unrelate new_alert_added severity contact timeline_event
2022-10-11 01:57:18 +05:30
issue_type relate_to_child unrelate_from_child relate_to_parent unrelate_from_parent
2017-08-17 22:00:37 +05:30
].freeze
2021-02-22 17:27:13 +05:30
validates :note, presence: true, unless: :importing?
2018-10-15 14:42:47 +05:30
validates :action, inclusion: { in: :icon_types }, allow_nil: true
2017-08-17 22:00:37 +05:30
belongs_to :note
2019-12-21 20:55:43 +05:30
belongs_to :description_version
2018-10-15 14:42:47 +05:30
2023-03-17 16:20:25 +05:30
delegate_missing_to :note
def declarative_policy_delegate
note
end
2018-10-15 14:42:47 +05:30
def icon_types
ICON_TYPES
end
2018-11-08 19:23:39 +05:30
def cross_reference_types
TYPES_WITH_CROSS_REFERENCES
end
2017-08-17 22:00:37 +05:30
end
2019-12-04 20:38:33 +05:30
2021-06-08 01:23:25 +05:30
SystemNoteMetadata.prepend_mod_with('SystemNoteMetadata')