From 39eaed7766e0f949d5692f3dfeb9a63e8f4b80f9 Mon Sep 17 00:00:00 2001 From: Pranav Raj S Date: Tue, 6 Jun 2023 15:16:25 -0700 Subject: [PATCH] fix: Cannot read properties of undefined (reading 'always_play_audio_alert') (#7260) --- app/javascript/dashboard/helper/scriptHelpers.js | 6 +++--- app/views/api/v1/accounts/create.json.jbuilder | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/javascript/dashboard/helper/scriptHelpers.js b/app/javascript/dashboard/helper/scriptHelpers.js index 7807f2b45..1169f2ee8 100644 --- a/app/javascript/dashboard/helper/scriptHelpers.js +++ b/app/javascript/dashboard/helper/scriptHelpers.js @@ -18,18 +18,18 @@ export const initializeAnalyticsEvents = () => { }); } }); - window.bus.$on(ANALYTICS_RESET, () => {}); }; const initializeAudioAlerts = user => { - // InitializeAudioNotifications const { ui_settings: uiSettings } = user || {}; const { always_play_audio_alert: alwaysPlayAudioAlert, enable_audio_alerts: audioAlertType, alert_if_unread_assigned_conversation_exist: alertIfUnreadConversationExist, notification_tone: audioAlertTone, - } = uiSettings; + // UI Settings can be undefined initally as we don't send the + // entire payload for the user during the signup process. + } = uiSettings || {}; DashboardAudioNotificationHelper.setInstanceValues({ currentUserId: user.id, diff --git a/app/views/api/v1/accounts/create.json.jbuilder b/app/views/api/v1/accounts/create.json.jbuilder index 240e04ae1..b423b534d 100644 --- a/app/views/api/v1/accounts/create.json.jbuilder +++ b/app/views/api/v1/accounts/create.json.jbuilder @@ -6,6 +6,7 @@ json.data do json.display_name resource.display_name json.email resource.email json.account_id @account.id + json.created_at resource.created_at json.pubsub_token resource.pubsub_token json.role resource.active_account_user&.role json.inviter_id resource.active_account_user&.inviter_id