From d7b564ea9f44e65c26e2dcc7b7759b67218e4513 Mon Sep 17 00:00:00 2001 From: Shivam Mishra Date: Sun, 2 Jun 2024 19:15:27 +0530 Subject: [PATCH] feat: use a generic name for inbox settings and agents page --- app/controllers/microsoft/callbacks_controller.rb | 4 ++-- config/routes.rb | 2 +- spec/controllers/microsoft/callbacks_controller_spec.rb | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/controllers/microsoft/callbacks_controller.rb b/app/controllers/microsoft/callbacks_controller.rb index 27a86caa8..3b4ff7d9f 100644 --- a/app/controllers/microsoft/callbacks_controller.rb +++ b/app/controllers/microsoft/callbacks_controller.rb @@ -9,9 +9,9 @@ class Microsoft::CallbacksController < OauthCallbackController inbox, already_exists = find_or_create_inbox if already_exists - redirect_to app_microsoft_inbox_settings_url(account_id: account.id, inbox_id: inbox.id) + redirect_to app_email_inbox_settings_url(account_id: account.id, inbox_id: inbox.id) else - redirect_to app_microsoft_inbox_agents_url(account_id: account.id, inbox_id: inbox.id) + redirect_to app_email_inbox_agents_url(account_id: account.id, inbox_id: inbox.id) end end diff --git a/config/routes.rb b/config/routes.rb index 9176155da..96aa36ec6 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -19,7 +19,7 @@ Rails.application.routes.draw do get '/app/accounts/:account_id/settings/inboxes/new/twitter', to: 'dashboard#index', as: 'app_new_twitter_inbox' get '/app/accounts/:account_id/settings/inboxes/new/microsoft', to: 'dashboard#index', as: 'app_new_microsoft_inbox' get '/app/accounts/:account_id/settings/inboxes/new/:inbox_id/agents', to: 'dashboard#index', as: 'app_twitter_inbox_agents' - get '/app/accounts/:account_id/settings/inboxes/new/:inbox_id/agents', to: 'dashboard#index', as: 'app_microsoft_inbox_agents' + get '/app/accounts/:account_id/settings/inboxes/new/:inbox_id/agents', to: 'dashboard#index', as: 'app_email_inbox_agents' get '/app/accounts/:account_id/settings/inboxes/:inbox_id', to: 'dashboard#index', as: 'app_microsoft_inbox_settings' resource :widget, only: [:show] diff --git a/spec/controllers/microsoft/callbacks_controller_spec.rb b/spec/controllers/microsoft/callbacks_controller_spec.rb index eb69953c8..41f91b368 100644 --- a/spec/controllers/microsoft/callbacks_controller_spec.rb +++ b/spec/controllers/microsoft/callbacks_controller_spec.rb @@ -28,7 +28,7 @@ RSpec.describe 'Microsoft::CallbacksController', type: :request do get microsoft_callback_url, params: { code: code } - expect(response).to redirect_to app_microsoft_inbox_agents_url(account_id: account.id, inbox_id: account.inboxes.last.id) + expect(response).to redirect_to app_email_inbox_agents_url(account_id: account.id, inbox_id: account.inboxes.last.id) expect(account.inboxes.count).to be 1 inbox = account.inboxes.last expect(inbox.name).to eq 'test' @@ -49,7 +49,7 @@ RSpec.describe 'Microsoft::CallbacksController', type: :request do get microsoft_callback_url, params: { code: code } - expect(response).to redirect_to app_microsoft_inbox_settings_url(account_id: account.id, inbox_id: account.inboxes.last.id) + expect(response).to redirect_to app_email_inbox_settings_url(account_id: account.id, inbox_id: account.inboxes.last.id) expect(account.inboxes.count).to be 1 expect(inbox.channel.reload.provider_config.keys).to include('access_token', 'refresh_token', 'expires_on') expect(inbox.channel.reload.provider_config['access_token']).to eq response_body_success[:access_token] @@ -65,7 +65,7 @@ RSpec.describe 'Microsoft::CallbacksController', type: :request do get microsoft_callback_url, params: { code: code } - expect(response).to redirect_to app_microsoft_inbox_agents_url(account_id: account.id, inbox_id: account.inboxes.last.id) + expect(response).to redirect_to app_email_inbox_agents_url(account_id: account.id, inbox_id: account.inboxes.last.id) expect(account.inboxes.count).to be 1 inbox = account.inboxes.last expect(inbox.name).to eq email.split('@').first.parameterize.titleize