2017-08-17 22:00:37 +05:30
|
|
|
module SystemNoteHelper
|
|
|
|
ICON_NAMES_BY_ACTION = {
|
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',
|
2018-03-17 18:26:18 +05:30
|
|
|
'duplicate' => 'issue-duplicate',
|
|
|
|
'locked' => 'lock',
|
2018-11-20 20:47:30 +05:30
|
|
|
'unlocked' => 'lock-open',
|
|
|
|
'due_date' => 'calendar'
|
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
|