From fbc42203127e30d5e0d872b85d560e0c46dfba24 Mon Sep 17 00:00:00 2001 From: Romaric Mourgues Date: Thu, 17 Nov 2022 11:04:12 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=9B=A0=20Fix=20missing=20notifications?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../notifications/services/preferences.ts | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/twake/backend/node/src/services/notifications/services/preferences.ts b/twake/backend/node/src/services/notifications/services/preferences.ts index fa2c8bdae1..6c61c40061 100644 --- a/twake/backend/node/src/services/notifications/services/preferences.ts +++ b/twake/backend/node/src/services/notifications/services/preferences.ts @@ -39,7 +39,25 @@ export class NotificationPreferencesService implements TwakeServiceProvider, Ini const notificationPreferences = (user?.preferences?.notifications || []).find(n => { return n.company_id === pk.company_id && n.workspace_id === pk.workspace_id; }); - return notificationPreferences; + return ( + notificationPreferences || { + company_id: pk.company_id, + workspace_id: pk.workspace_id, + preferences: { + highlight_words: [], + night_break: { + enable: false, + from: 0, + to: 0, + }, + private_message_content: false, + mobile_notifications: "always", + email_notifications_delay: 15, + deactivate_notifications_until: 0, + notification_sound: "default", + }, + } + ); } /** We can define preferences for specifically a workspace or for all a company or all Twake