diff --git a/app/routes/discourse.rb b/app/routes/discourse.rb index e3b4cfe..dc22788 100644 --- a/app/routes/discourse.rb +++ b/app/routes/discourse.rb @@ -2,4 +2,7 @@ Discourse::Application.routes.append do mount ::DiscourseChat::AdminEngine, at: '/admin/plugins/chat', constraints: AdminConstraint.new mount ::DiscourseChat::PublicEngine, at: '/chat-transcript/', as: 'chat-transcript' mount ::DiscourseChat::Provider::HookEngine, at: '/chat-integration/' + + # For backwards compatibility with Slack plugin + post "/slack/command" => "discourse_chat/provider/slack_provider/slack_command#command" end diff --git a/spec/lib/discourse_chat/provider/slack/slack_command_controller_spec.rb b/spec/lib/discourse_chat/provider/slack/slack_command_controller_spec.rb index ec52aac..2a32fe0 100644 --- a/spec/lib/discourse_chat/provider/slack/slack_command_controller_spec.rb +++ b/spec/lib/discourse_chat/provider/slack/slack_command_controller_spec.rb @@ -53,6 +53,20 @@ describe 'Slack Command Controller', type: :request do end end + describe 'backwards compatibility with discourse-slack-official' do + it 'should return the right response' do + token = 'secret sauce' + SiteSetting.chat_integration_slack_incoming_webhook_token = token + + post '/slack/command.json', params: { + text: 'help', token: token + } + + expect(response.status).to eq(200) + expect(JSON.parse(response.body)["text"]).to be_present + end + end + describe 'when incoming webhook token has not been set' do it 'should raise the right error' do post '/chat-integration/slack/command.json', params: {