Compare commits

...

1 Commits

Author SHA1 Message Date
Saad Yousaf
367007f5d6 fix: handle app wide channel notification preference through existing endpoint 2024-02-16 14:59:16 +05:00
2 changed files with 2 additions and 14 deletions

View File

@@ -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(() => (

View File

@@ -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());
}
}
);