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 = {
|
2020-04-08 14:13:33 +05:30
|
|
|
'cherry_pick' => 'cherry-pick-commit',
|
2018-03-17 18:26:18 +05:30
|
|
|
'commit' => 'commit',
|
2018-10-15 14:42:47 +05:30
|
|
|
'description' => 'pencil-square',
|
2018-03-17 18:26:18 +05:30
|
|
|
'merge' => 'git-merge',
|
|
|
|
'merged' => 'git-merge',
|
|
|
|
'opened' => 'issue-open',
|
|
|
|
'closed' => 'issue-close',
|
|
|
|
'time_tracking' => 'timer',
|
|
|
|
'assignee' => 'user',
|
2018-10-15 14:42:47 +05:30
|
|
|
'title' => 'pencil-square',
|
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',
|
2018-10-15 14:42:47 +05:30
|
|
|
'outdated' => 'pencil-square',
|
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',
|
|
|
|
'health_status' => 'status-health'
|
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
|
|
|
|
|
|
|
SystemNoteHelper.prepend_if_ee('EE::SystemNoteHelper') # rubocop: disable Cop/InjectEnterpriseEditionModule
|
|
|
|
|
|
|
|
# The methods in `EE::SystemNoteHelper` should be available as both instance and
|
|
|
|
# class methods.
|
|
|
|
SystemNoteHelper.extend_if_ee('EE::SystemNoteHelper')
|