From 05127467c2b30afbfd3be737dedf3f8db86a7440 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C3=BAl=20Ibarra=20Corretg=C3=A9?= Date: Mon, 16 May 2022 11:27:31 +0200 Subject: [PATCH] feat(notifications) add ability to disable specific notifications This works together with the broader "notifications" config option. One might choose to leave the existing option unespecified *thus allowing all notifications) and then use this new one to be explicit about which ones to disable. --- config.js | 3 +++ react/features/base/config/configWhitelist.js | 1 + react/features/notifications/actions.js | 4 +++- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/config.js b/config.js index 4de947c0c..19c89b653 100644 --- a/config.js +++ b/config.js @@ -1344,6 +1344,9 @@ var config = { // 'transcribing.failedToStart' // shown when transcribing fails to start // ], + // List of notifications to be disabled. Works in tandem with the above setting. + // disabledNotifications: [], + // Prevent the filmstrip from autohiding when screen width is under a certain threshold // disableFilmstripAutohiding: false, diff --git a/react/features/base/config/configWhitelist.js b/react/features/base/config/configWhitelist.js index 78c55ab26..ada80f796 100644 --- a/react/features/base/config/configWhitelist.js +++ b/react/features/base/config/configWhitelist.js @@ -94,6 +94,7 @@ export default [ 'disableBeforeUnloadHandlers', 'disableChatSmileys', 'disableDeepLinking', + 'disabledNotifications', 'disabledSounds', 'disableFilmstripAutohiding', 'disableInitialGUM', diff --git a/react/features/notifications/actions.js b/react/features/notifications/actions.js index 0d0ec8d26..0d79cd88c 100644 --- a/react/features/notifications/actions.js +++ b/react/features/notifications/actions.js @@ -109,10 +109,12 @@ export function showErrorNotification(props: Object, type: ?string) { */ export function showNotification(props: Object = {}, type: ?string) { return function(dispatch: Function, getState: Function) { - const { notifications, notificationTimeouts } = getState()['features/base/config']; + const { disabledNotifications = [], notifications, notificationTimeouts } = getState()['features/base/config']; const enabledFlag = getFeatureFlag(getState(), NOTIFICATIONS_ENABLED, true); const shouldDisplay = enabledFlag + && !(disabledNotifications.includes(props.descriptionKey) + || disabledNotifications.includes(props.titleKey)) && (!notifications || notifications.includes(props.descriptionKey) || notifications.includes(props.titleKey));