2019-02-15 15:39:39 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
module Gitlab
|
2017-09-10 17:25:29 +05:30
|
|
|
module SlashCommands
|
2017-08-17 22:00:37 +05:30
|
|
|
module Presenters
|
|
|
|
class Access < Presenters::Base
|
2019-12-04 20:38:33 +05:30
|
|
|
def access_denied(project)
|
|
|
|
ephemeral_response(text: <<~MESSAGE)
|
|
|
|
You are not allowed to perform the given chatops command. Most
|
|
|
|
likely you do not have access to the GitLab project for this chatops
|
|
|
|
integration.
|
|
|
|
|
|
|
|
The GitLab project for this chatops integration can be found at
|
|
|
|
#{url_for(project)}.
|
|
|
|
MESSAGE
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
def not_found
|
|
|
|
ephemeral_response(text: "404 not found! GitLab couldn't find what you were looking for! :boom:")
|
|
|
|
end
|
|
|
|
|
|
|
|
def authorize
|
|
|
|
message =
|
|
|
|
if @resource
|
|
|
|
":wave: Hi there! Before I do anything for you, please [connect your GitLab account](#{@resource})."
|
|
|
|
else
|
2018-11-08 19:23:39 +05:30
|
|
|
":sweat_smile: Couldn't identify you, nor can I authorize you!"
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
ephemeral_response(text: message)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|