From dfdfc669ea737ed55d1193c24679621953e7f8ed Mon Sep 17 00:00:00 2001 From: Muhsin Date: Wed, 1 Apr 2026 14:22:50 +0400 Subject: [PATCH] chore: reserve api_key_secret and update voice UI --- .../inbox/settingsPage/VoiceConfigurationPage.vue | 9 ++++++++- enterprise/app/services/twilio/voice_teardown_service.rb | 2 +- spec/enterprise/models/channel/twilio_sms_voice_spec.rb | 7 +++---- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/app/javascript/dashboard/routes/dashboard/settings/inbox/settingsPage/VoiceConfigurationPage.vue b/app/javascript/dashboard/routes/dashboard/settings/inbox/settingsPage/VoiceConfigurationPage.vue index cf954c353..ab9a147a1 100644 --- a/app/javascript/dashboard/routes/dashboard/settings/inbox/settingsPage/VoiceConfigurationPage.vue +++ b/app/javascript/dashboard/routes/dashboard/settings/inbox/settingsPage/VoiceConfigurationPage.vue @@ -33,8 +33,15 @@ export default { hasApiKeySid() { return !!this.inbox.api_key_sid; }, + hasExistingCredentials() { + return this.hasApiKeySid; + }, needsCredentials() { - return this.voiceEnabled && !this.isVoiceConfigured; + return ( + this.voiceEnabled && + !this.isVoiceConfigured && + !this.hasExistingCredentials + ); }, needsApiKeySid() { return this.needsCredentials && !this.hasApiKeySid; diff --git a/enterprise/app/services/twilio/voice_teardown_service.rb b/enterprise/app/services/twilio/voice_teardown_service.rb index af171050f..f343ce431 100644 --- a/enterprise/app/services/twilio/voice_teardown_service.rb +++ b/enterprise/app/services/twilio/voice_teardown_service.rb @@ -16,7 +16,7 @@ class Twilio::VoiceTeardownService end def clear_voice_credentials - channel.update!(twiml_app_sid: nil, api_key_secret: nil) + channel.update!(twiml_app_sid: nil) end def twilio_client diff --git a/spec/enterprise/models/channel/twilio_sms_voice_spec.rb b/spec/enterprise/models/channel/twilio_sms_voice_spec.rb index c2e0a8edd..c825828b3 100644 --- a/spec/enterprise/models/channel/twilio_sms_voice_spec.rb +++ b/spec/enterprise/models/channel/twilio_sms_voice_spec.rb @@ -73,19 +73,19 @@ RSpec.describe Channel::TwilioSms do allow(app_context).to receive(:delete) end - it 'deletes the TwiML app and clears voice credentials' do + it 'deletes the TwiML app and clears twiml_app_sid' do original_twiml_sid = channel.twiml_app_sid channel.update!(voice_enabled: false) expect(twilio_client).to have_received(:applications).with(original_twiml_sid) expect(app_context).to have_received(:delete) expect(channel.reload.twiml_app_sid).to be_nil - expect(channel.reload.api_key_secret).to be_nil end - it 'preserves api_key_sid' do + it 'preserves api_key_sid and api_key_secret' do channel.update!(voice_enabled: false) expect(channel.reload.api_key_sid).to be_present + expect(channel.reload.api_key_secret).to be_present end it 'does not fail if Twilio API errors' do @@ -94,7 +94,6 @@ RSpec.describe Channel::TwilioSms do expect { channel.update!(voice_enabled: false) }.not_to raise_error expect(channel.reload.twiml_app_sid).to be_nil - expect(channel.reload.api_key_secret).to be_nil end end end