diff --git a/src/notification-preferences/NotificationPreferenceApp.jsx b/src/notification-preferences/NotificationPreferenceApp.jsx index 7e37a1be1..6eaddfb98 100644 --- a/src/notification-preferences/NotificationPreferenceApp.jsx +++ b/src/notification-preferences/NotificationPreferenceApp.jsx @@ -32,10 +32,11 @@ const NotificationPreferenceApp = ({ appId }) => { const isPreferenceNonEditable = (preference) => nonEditable?.[preference.id]?.includes(notificationChannel) || false; - const truePreferences = appPreferences.filter((preference) => preference[notificationChannel] === true - && !isPreferenceNonEditable(preference)); + const activePreferences = appPreferences.filter( + (preference) => preference[notificationChannel] && !isPreferenceNonEditable(preference), + ); - dispatch(updateChannelPreferenceToggle(courseId, appId, notificationChannel, truePreferences.length === 0)); + dispatch(updateChannelPreferenceToggle(courseId, appId, notificationChannel, activePreferences.length === 0)); }, [appId, appPreferences, courseId, dispatch, nonEditable]); const preferences = useMemo(() => (