From 1d555cebfc5a9944ad93fef8ee4432a4517739eb Mon Sep 17 00:00:00 2001 From: Muhsin Date: Fri, 27 Mar 2026 13:37:04 +0400 Subject: [PATCH] chore: handle Twilio API Key SID conditionally --- .../settingsPage/VoiceConfigurationPage.vue | 22 +++++++++++++++++-- app/views/api/v1/models/_inbox.json.jbuilder | 1 + 2 files changed, 21 insertions(+), 2 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 eaa56fae4..c8bc3124d 100644 --- a/app/javascript/dashboard/routes/dashboard/settings/inbox/settingsPage/VoiceConfigurationPage.vue +++ b/app/javascript/dashboard/routes/dashboard/settings/inbox/settingsPage/VoiceConfigurationPage.vue @@ -29,24 +29,41 @@ export default { isVoiceConfigured() { return !!this.inbox.voice_configured; }, + hasApiKeySid() { + return !!this.inbox.api_key_sid; + }, needsCredentials() { return this.voiceEnabled && !this.isVoiceConfigured; }, + needsApiKeySid() { + return this.needsCredentials && !this.hasApiKeySid; + }, isSubmitDisabled() { if (!this.voiceEnabled) return false; if (this.needsCredentials) { - return !this.apiKeySid || !this.apiKeySecret; + if (this.needsApiKeySid && !this.apiKeySid) return true; + return !this.apiKeySecret; } return false; }, }, + watch: { + 'inbox.voice_enabled'(val) { + this.voiceEnabled = val || false; + }, + 'inbox.api_key_sid'(val) { + this.apiKeySid = val || ''; + }, + }, methods: { async updateVoiceSettings() { try { const channelPayload = { voice_enabled: this.voiceEnabled }; if (this.needsCredentials) { - channelPayload.api_key_sid = this.apiKeySid; + if (this.needsApiKeySid) { + channelPayload.api_key_sid = this.apiKeySid; + } channelPayload.api_key_secret = this.apiKeySecret; } @@ -79,6 +96,7 @@ export default { {{ $t('INBOX_MGMT.VOICE_CONFIGURATION.CREDENTIALS.DESCRIPTION') }}