diff options
Diffstat (limited to 'app/models/integrations/slack_slash_commands.rb')
-rw-r--r-- | app/models/integrations/slack_slash_commands.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/app/models/integrations/slack_slash_commands.rb b/app/models/integrations/slack_slash_commands.rb index c5ea6f22951..401ef4fb9fc 100644 --- a/app/models/integrations/slack_slash_commands.rb +++ b/app/models/integrations/slack_slash_commands.rb @@ -4,6 +4,8 @@ module Integrations class SlackSlashCommands < BaseSlashCommands include Ci::TriggersHelper + SLACK_REDIRECT_URL = 'slack://channel?team=%{TEAM}&id=%{CHANNEL}' + field :token, type: :password, non_empty_password_title: -> { s_('ProjectService|Enter new token') }, @@ -29,6 +31,18 @@ module Integrations end end + def redirect_url(team, channel, _url) + Kernel.format(SLACK_REDIRECT_URL, TEAM: team, CHANNEL: channel) + end + + def confirmation_url(command_id, params) + team, channel, response_url = params.values_at(:team_id, :channel_id, :response_url) + + Rails.application.routes.url_helpers.project_integrations_slash_commands_url( + project, command_id: command_id, integration: to_param, team: team, channel: channel, response_url: response_url + ) + end + private def format(text) |