From 706bc39551d9ad43d20bd776504639d461b20117 Mon Sep 17 00:00:00 2001 From: Tanmay Deep Sharma Date: Tue, 14 Jul 2026 18:10:09 +0530 Subject: [PATCH] fix(twilio): save voice calling toggle immediately instead of requiring update --- .../settingsPage/VoiceConfigurationPage.vue | 52 +++++++++++++++---- 1 file changed, 43 insertions(+), 9 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 b5f3183f1..6b30b1136 100644 --- a/app/javascript/dashboard/routes/dashboard/settings/inbox/settingsPage/VoiceConfigurationPage.vue +++ b/app/javascript/dashboard/routes/dashboard/settings/inbox/settingsPage/VoiceConfigurationPage.vue @@ -88,6 +88,28 @@ export default { this.isTogglingInbound = false; } }, + // Saves on toggle, except when enabling still needs API key credentials: then we + // reveal the inputs and wait for the user to submit them. + async handleVoiceToggle(newValue) { + if (this.isUpdating) return; + const previousValue = this.voiceEnabled; + this.voiceEnabled = newValue; + + if (this.needsCredentials) return; + + try { + await this.updateVoiceSettings(); + } catch (_) { + this.voiceEnabled = previousValue; + } + }, + async submitVoiceCredentials() { + try { + await this.updateVoiceSettings(); + } catch (_) { + this.voiceEnabled = false; + } + }, async updateVoiceSettings() { this.isUpdating = true; try { @@ -109,6 +131,7 @@ export default { useAlert(this.$t('INBOX_MGMT.EDIT.API.SUCCESS_MESSAGE')); } catch (error) { useAlert(this.$t('INBOX_MGMT.EDIT.API.ERROR_MESSAGE')); + throw error; } finally { this.isUpdating = false; } @@ -119,13 +142,24 @@ export default {