summaryrefslogtreecommitdiff
path: root/lib/gitlab/slash_commands/presenters/note_base.rb
blob: 7758fc740de637764a6c6c1b689abf8ea68de1b6 (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
# 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 project_link
          "[#{project.full_name}](#{project.web_url})"
        end

        def author
          resource.author
        end

        def author_profile_link
          "[#{author.to_reference}](#{url_for(author)})"
        end

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

        private

        attr_reader :resource
      end
    end
  end
end