From 499ac053eeafb49a88ad6d1843c6c53b3ad75cde Mon Sep 17 00:00:00 2001 From: Tanmay Deep Sharma Date: Sun, 3 May 2026 15:40:30 +0700 Subject: [PATCH] chore(voice): drop debug toasts; appease rubocop on inbox jbuilder MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Remove the [debug] useAlert breadcrumbs that surfaced the accept-call silent-fail (the !conversation guard). The actual fix from 6ed9500792 stays. - Rubocop Style/IfUnlessModifier on the WhatsApp voice_enabled jbuilder block — convert to modifier form. --- .../components/widgets/FloatingCallWidget.vue | 11 +---------- .../dashboard/composables/useCallSession.js | 16 +--------------- app/views/api/v1/models/_inbox.json.jbuilder | 4 +--- 3 files changed, 3 insertions(+), 28 deletions(-) diff --git a/app/javascript/dashboard/components/widgets/FloatingCallWidget.vue b/app/javascript/dashboard/components/widgets/FloatingCallWidget.vue index 36c89597a..a8f4326b1 100644 --- a/app/javascript/dashboard/components/widgets/FloatingCallWidget.vue +++ b/app/javascript/dashboard/components/widgets/FloatingCallWidget.vue @@ -4,7 +4,6 @@ import { useRouter } from 'vue-router'; import { useStore } from 'vuex'; import { useCallSession } from 'dashboard/composables/useCallSession'; import { setWhatsappCallMuted } from 'dashboard/composables/useWhatsappCallSession'; -import { useAlert } from 'dashboard/composables'; import WindowVisibilityHelper from 'dashboard/helper/AudioAlerts/WindowVisibilityHelper'; import Avatar from 'dashboard/components-next/avatar/Avatar.vue'; @@ -75,15 +74,7 @@ const handleEndCall = async () => { }; const handleJoinCall = async call => { - useAlert('[debug] handleJoinCall click handler fired'); - if (!call) { - useAlert('[debug] handleJoinCall bailed: no call object'); - return; - } - if (isJoining.value) { - useAlert('[debug] handleJoinCall bailed: already joining'); - return; - } + if (!call || isJoining.value) return; const { conversation } = getCallInfo(call); // End current active call before joining new one diff --git a/app/javascript/dashboard/composables/useCallSession.js b/app/javascript/dashboard/composables/useCallSession.js index 7b4a210b3..39312eb4d 100644 --- a/app/javascript/dashboard/composables/useCallSession.js +++ b/app/javascript/dashboard/composables/useCallSession.js @@ -9,7 +9,6 @@ import { cleanupWhatsappSession, } from 'dashboard/composables/useWhatsappCallSession'; import { handleVoiceCallCreated } from 'dashboard/helper/voice'; -import { useAlert } from 'dashboard/composables'; import Timer from 'dashboard/helper/Timer'; const isWhatsappCall = call => call?.provider === 'whatsapp'; @@ -123,34 +122,22 @@ export function useCallSession() { }; const joinCall = async ({ conversationId, inboxId, callSid }) => { - useAlert(`[debug] joinCall: callSid=${callSid} inboxId=${inboxId}`); - if (isJoining.value) { - useAlert('[debug] joinCall bailed: isJoining flag stuck'); - return null; - } + if (isJoining.value) return null; isJoining.value = true; try { const call = findCall(callSid); - useAlert( - `[debug] found call? provider=${call?.provider} callId=${call?.callId} hasSdpOffer=${Boolean(call?.sdpOffer)}` - ); if (isWhatsappCall(call)) { - useAlert('[debug] taking WhatsApp accept path'); await whatsappSession.acceptIncomingCall({ callId: call.callId, sdpOffer: call.sdpOffer, iceServers: call.iceServers, }); - useAlert('[debug] /accept POST succeeded'); callsStore.setCallActive(callSid); durationTimer.start(); return { callId: call.callId }; } - useAlert( - `[debug] taking Twilio path — provider mismatch: ${call?.provider}` - ); const device = await TwilioVoiceClient.initializeDevice(inboxId); if (!device) return null; @@ -171,7 +158,6 @@ export function useCallSession() { return { conferenceSid: joinResponse?.conference_sid }; } catch (error) { - useAlert(`[debug] joinCall threw: ${error?.message || error}`); // eslint-disable-next-line no-console console.error('Failed to join call:', error); // Tear down any half-built WebRTC state so the user's next click starts diff --git a/app/views/api/v1/models/_inbox.json.jbuilder b/app/views/api/v1/models/_inbox.json.jbuilder index c60b6f98a..89a6258ad 100644 --- a/app/views/api/v1/models/_inbox.json.jbuilder +++ b/app/views/api/v1/models/_inbox.json.jbuilder @@ -144,6 +144,4 @@ if resource.twilio? && resource.channel.respond_to?(:voice_enabled?) end ## Voice attribute for WhatsApp Cloud (only embedded-signup channels surface true) -if resource.channel_type == 'Channel::Whatsapp' && resource.channel.respond_to?(:voice_enabled?) - json.voice_enabled resource.channel.voice_enabled? -end +json.voice_enabled resource.channel.voice_enabled? if resource.channel_type == 'Channel::Whatsapp' && resource.channel.respond_to?(:voice_enabled?)