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

module Gitlab
  module SlashCommands
    module Presenters
      class IssueNew < Presenters::Base
        include Presenters::IssueBase

        def present
          in_channel_response(response_message)
        end

        private

        def pretext
          "I created an issue on #{author_profile_link}'s behalf: *#{issue_link}* in #{project_link}"
        end

        def issue_link
          "[#{issue.to_reference}](#{project_issue_url(issue.project, issue)})"
        end

        def response_message(custom_pretext: pretext)
          {
            text: pretext
          }
        end
      end
    end
  end
end