fix: Slack integration redirect url missing the client ID (#2309)

Fixes: #2304
This commit is contained in:
Sojan Jose 2021-05-21 00:03:09 +05:30 committed by GitHub
parent 2a492b4162
commit bb1c028926
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 0 deletions

View file

@ -2,6 +2,7 @@ json.call(resource.params, *resource.params.keys)
json.name resource.name json.name resource.name
json.description resource.description json.description resource.description
json.enabled resource.enabled?(@current_account) json.enabled resource.enabled?(@current_account)
json.action resource.action
json.button resource.action json.button resource.action
json.hooks do json.hooks do
json.array! @current_account.hooks.where(app_id: resource.id) do |hook| json.array! @current_account.hooks.where(app_id: resource.id) do |hook|

View file

@ -25,6 +25,21 @@ RSpec.describe 'Integration Apps API', type: :request do
expect(apps['id']).to eql(first_app.id) expect(apps['id']).to eql(first_app.id)
expect(apps['name']).to eql(first_app.name) expect(apps['name']).to eql(first_app.name)
end end
it 'returns slack app with appropriate redirect url when configured' do
ENV['SLACK_CLIENT_ID'] = 'client_id'
ENV['SLACK_CLIENT_SECRET'] = 'client_secret'
get api_v1_account_integrations_apps_url(account),
headers: agent.create_new_auth_token,
as: :json
expect(response).to have_http_status(:success)
apps = JSON.parse(response.body)['payload']
slack_app = apps.find { |app| app['id'] == 'slack' }
expect(slack_app['action']).to include('client_id=client_id')
ENV['SLACK_CLIENT_ID'] = nil
ENV['SLACK_CLIENT_SECRET'] = nil
end
end end
end end