debian-mirror-gitlab/app/helpers/system_note_helper.rb

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

72 lines
2 KiB
Ruby
Raw Normal View History

2018-12-05 23:21:45 +05:30
# frozen_string_literal: true
2017-08-17 22:00:37 +05:30
module SystemNoteHelper
ICON_NAMES_BY_ACTION = {
2021-01-03 14:25:43 +05:30
'approved' => 'approval',
'unapproved' => 'unapproval',
2020-04-08 14:13:33 +05:30
'cherry_pick' => 'cherry-pick-commit',
2018-03-17 18:26:18 +05:30
'commit' => 'commit',
2022-07-23 23:45:48 +05:30
'description' => 'pencil',
2018-03-17 18:26:18 +05:30
'merge' => 'git-merge',
'merged' => 'git-merge',
2020-11-24 15:15:51 +05:30
'opened' => 'issues',
2018-03-17 18:26:18 +05:30
'closed' => 'issue-close',
'time_tracking' => 'timer',
'assignee' => 'user',
2021-01-03 14:25:43 +05:30
'reviewer' => 'user',
2022-07-23 23:45:48 +05:30
'title' => 'pencil',
2018-03-17 18:26:18 +05:30
'task' => 'task-done',
'label' => 'label',
'cross_reference' => 'comment-dots',
'branch' => 'fork',
'confidential' => 'eye-slash',
'visible' => 'eye',
'milestone' => 'clock',
'discussion' => 'comment',
'moved' => 'arrow-right',
2022-07-23 23:45:48 +05:30
'outdated' => 'pencil',
2019-10-12 21:52:04 +05:30
'pinned_embed' => 'thumbtack',
2020-04-08 14:13:33 +05:30
'duplicate' => 'duplicate',
2018-03-17 18:26:18 +05:30
'locked' => 'lock',
2018-11-20 20:47:30 +05:30
'unlocked' => 'lock-open',
2020-04-22 19:07:51 +05:30
'due_date' => 'calendar',
2022-08-27 11:52:29 +05:30
'start_date_or_due_date' => 'calendar',
2020-05-24 23:13:21 +05:30
'health_status' => 'status-health',
'designs_added' => 'doc-image',
'designs_modified' => 'doc-image',
'designs_removed' => 'doc-image',
2020-07-28 23:09:34 +05:30
'designs_discussion_added' => 'doc-image',
'status' => 'status',
2020-11-24 15:15:51 +05:30
'alert_issue_added' => 'issues',
2021-01-03 14:25:43 +05:30
'new_alert_added' => 'warning',
2021-02-22 17:27:13 +05:30
'severity' => 'information-o',
2021-11-11 11:23:49 +05:30
'cloned' => 'documents',
2022-07-23 23:45:48 +05:30
'issue_type' => 'pencil',
2022-01-26 12:08:38 +05:30
'attention_requested' => 'user',
2022-04-04 11:22:00 +05:30
'attention_request_removed' => 'user',
2022-07-16 23:28:13 +05:30
'contact' => 'users',
2022-10-11 01:57:18 +05:30
'timeline_event' => 'clock',
'relate_to_child' => 'link',
'unrelate_from_child' => 'link',
'relate_to_parent' => 'link',
'unrelate_from_parent' => 'link'
2017-08-17 22:00:37 +05:30
}.freeze
2018-03-17 18:26:18 +05:30
def system_note_icon_name(note)
ICON_NAMES_BY_ACTION[note.system_note_metadata&.action]
end
2017-08-17 22:00:37 +05:30
def icon_for_system_note(note)
2018-03-17 18:26:18 +05:30
icon_name = system_note_icon_name(note)
sprite_icon(icon_name) if icon_name
2017-08-17 22:00:37 +05:30
end
2018-03-17 18:26:18 +05:30
extend self
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
SystemNoteHelper.prepend_mod_with('SystemNoteHelper')
2019-12-04 20:38:33 +05:30
# The methods in `EE::SystemNoteHelper` should be available as both instance and
# class methods.
2021-06-08 01:23:25 +05:30
SystemNoteHelper.extend_mod_with('SystemNoteHelper')