Welcome to mirror list, hosted at ThFree Co, Russian Federation.

system_note_helper.rb « helpers « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: f2e1d158c2d499c11126ee34cbb86c3d9a179270 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# frozen_string_literal: true

module SystemNoteHelper
  ICON_NAMES_BY_ACTION = {
    'approved' => 'approval',
    'unapproved' => 'unapproval',
    'cherry_pick' => 'cherry-pick-commit',
    'commit' => 'commit',
    'description' => 'pencil-square',
    'merge' => 'git-merge',
    'merged' => 'git-merge',
    'opened' => 'issues',
    'closed' => 'issue-close',
    'time_tracking' => 'timer',
    'assignee' => 'user',
    'reviewer' => 'user',
    'title' => 'pencil-square',
    'task' => 'task-done',
    'label' => 'label',
    'cross_reference' => 'comment-dots',
    'branch' => 'fork',
    'confidential' => 'eye-slash',
    'visible' => 'eye',
    'milestone' => 'clock',
    'discussion' => 'comment',
    'moved' => 'arrow-right',
    'outdated' => 'pencil-square',
    'pinned_embed' => 'thumbtack',
    'duplicate' => 'duplicate',
    'locked' => 'lock',
    'unlocked' => 'lock-open',
    'due_date' => 'calendar',
    'health_status' => 'status-health',
    'designs_added' => 'doc-image',
    'designs_modified' => 'doc-image',
    'designs_removed' => 'doc-image',
    'designs_discussion_added' => 'doc-image',
    'status' => 'status',
    'alert_issue_added' => 'issues',
    'new_alert_added' => 'warning',
    'severity' => 'information-o',
    'cloned' => 'documents',
    'issue_type' => 'pencil-square',
    'attention_requested' => 'user',
    'attention_request_removed' => 'user'
  }.freeze

  def system_note_icon_name(note)
    ICON_NAMES_BY_ACTION[note.system_note_metadata&.action]
  end

  def icon_for_system_note(note)
    icon_name = system_note_icon_name(note)
    sprite_icon(icon_name) if icon_name
  end

  extend self
end

SystemNoteHelper.prepend_mod_with('SystemNoteHelper')

# The methods in `EE::SystemNoteHelper` should be available as both instance and
# class methods.
SystemNoteHelper.extend_mod_with('SystemNoteHelper')