From 367007f5d6caf26c334250c30a2a24c8c7d57d1e Mon Sep 17 00:00:00 2001 From: Saad Yousaf Date: Fri, 16 Feb 2024 14:59:16 +0500 Subject: [PATCH] fix: handle app wide channel notification preference through existing endpoint --- .../NotificationPreferenceApp.jsx | 4 ++-- src/notification-preferences/data/thunks.js | 12 ------------ 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/src/notification-preferences/NotificationPreferenceApp.jsx b/src/notification-preferences/NotificationPreferenceApp.jsx index 1ab67b030..e7c0da546 100644 --- a/src/notification-preferences/NotificationPreferenceApp.jsx +++ b/src/notification-preferences/NotificationPreferenceApp.jsx @@ -14,7 +14,7 @@ import { selectUpdatePreferencesStatus, } from './data/selectors'; import NotificationPreferenceRow from './NotificationPreferenceRow'; -import { updateAppPreferenceToggle, updateChannelPreferenceToggle } from './data/thunks'; +import { updatePreferenceToggle } from './data/thunks'; import { LOADING_STATUS } from '../constants'; import NOTIFICATION_CHANNELS from './data/constants'; @@ -35,7 +35,7 @@ const NotificationPreferenceApp = ({ appId }) => { (preference) => preference[notificationChannel] && !isPreferenceNonEditable(preference), ); - dispatch(updateChannelPreferenceToggle(courseId, appId, notificationChannel, !hasActivePreferences)); + dispatch(updatePreferenceToggle(courseId, appId, notificationChannel, !hasActivePreferences)); }, [appId, appPreferences, courseId, dispatch, nonEditable]); const preferences = useMemo(() => ( diff --git a/src/notification-preferences/data/thunks.js b/src/notification-preferences/data/thunks.js index 222201b52..641bd6b50 100644 --- a/src/notification-preferences/data/thunks.js +++ b/src/notification-preferences/data/thunks.js @@ -149,15 +149,3 @@ export const updatePreferenceToggle = ( } } ); - -export const updateChannelPreferenceToggle = (courseId, notificationApp, notificationChannel, value) => ( - async (dispatch) => { - try { - const data = await patchChannelPreferenceToggle(courseId, notificationApp, notificationChannel, value); - const normalizedData = normalizePreferences(camelCaseObject(data)); - dispatch(fetchNotificationPreferenceSuccess(courseId, normalizedData)); - } catch (errors) { - dispatch(fetchNotificationPreferenceFailed()); - } - } -);