Commit 25faa060 authored by Annabel Dunstone Gray's avatar Annabel Dunstone Gray Committed by Jacob Schatz

Rewrite system note helper

parent 2c9239fb
module SystemNoteHelper module SystemNoteHelper
def icon_for_system_note(note) ICON_NAMES_BY_ACTION = {
'commit' => 'icon_commit',
icon_name = 'merge' => 'icon_merge',
case note.system_note_metadata.action 'merged' => 'icon_merged',
when 'commit' 'opened' => 'icon_status_open',
'icon_commit' 'closed' => 'icon_status_closed',
when 'merge' 'time_tracking' => 'icon_stopwatch',
'icon_merge' 'assignee' => 'icon_user',
when 'merged' 'title' => 'icon_pencil',
'icon_merged' 'task' => 'icon_check_square_o',
when 'opened' 'label' => 'icon_tags',
'icon_status_open' 'cross_reference' => 'icon_random',
when 'closed' 'branch' => 'icon_code_fork',
'icon_status_closed' 'confidential' => 'icon_eye_slash',
when 'time_tracking' 'visible' => 'icon_eye',
'icon_stopwatch' 'milestone' => 'icon_clock_o',
when 'assignee' 'discussion' => 'icon_comment_o',
'icon_user' 'moved' => 'icon_arrow-circle-o-right'
when 'title' }.freeze
'icon_edit'
when 'task'
'icon_check_square_o'
when 'label'
'icon_tags'
when 'cross_reference'
'icon_random'
when 'branch'
'icon_code_fork'
when 'confidential'
'icon_eye_slash'
when 'visible'
'icon_eye'
when 'milestone'
'icon_clock_o'
when 'discussion'
'icon_comment_o'
when 'moved'
'icon_arrow-circle-o-right'
end
def icon_for_system_note(note)
icon_name = ICON_NAMES_BY_ACTION[note.system_note_metadata&.action]
custom_icon(icon_name) if icon_name custom_icon(icon_name) if icon_name
end end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment