summaryrefslogtreecommitdiff
path: root/lib/gitlab/chat_commands/presenters/deploy.rb
blob: b1cfaac15afd47a1189401de82c24fccc3ad895e (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
module Gitlab
  module ChatCommands
    module Presenters
      class Deploy < Presenters::Base
        def present(from, to)
          message = "Deployment started from #{from} to #{to}. [Follow its progress](#{resource_url})."

          in_channel_response(text: message)
        end

        def no_actions
          ephemeral_response(text: "No action found to be executed")
        end

        def too_many_actions
          ephemeral_response(text: "Too many actions defined")
        end

        private

        def resource_url
          polymorphic_url(
            [ @resource.project.namespace.becomes(Namespace), @resource.project, @resource]
          )
        end
      end
    end
  end
end