summaryrefslogtreecommitdiff
path: root/lib/gitlab/slash_commands/presenters/note_base.rb
blob: 71a9b99d0fde38f3d784e3576c5bafa2a3e1d389 (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
# frozen_string_literal: true

module Gitlab
  module SlashCommands
    module Presenters
      module NoteBase
        GREEN = '#38ae67'

        def color(_)
          GREEN
        end

        def issue
          resource.noteable
        end

        def project
          issue.project
        end

        def author
          resource.author
        end

        def fields
          [
            {
              title: 'Comment',
              value: resource.note
            }
          ]
        end

        private

        attr_reader :resource
      end
    end
  end
end