feat: added notification preferences settings at account level (#1159)
* feat: added notification preferences settings at account level * fix: fixed test cases * feat: added api for account notification type * fix: fixed test cases and label * test: added update account preference test case * fix: fixed issue to update email cadence for account notification type * refactor: updated time * fix: fixed mixed cadence issue * fix: fixed border issue when no preferences * refactor: refactor code --------- Co-authored-by: sundasnoreen12 <sundasnoreen12@gmail.com>
This commit is contained in:
@@ -28,7 +28,9 @@ const NotificationPreferenceColumn = ({ appId, channel, appPreference }) => {
|
||||
|
||||
const onToggle = useCallback((event, notificationType) => {
|
||||
const { name: notificationChannel } = event.target;
|
||||
const value = notificationChannel === 'email_cadence' ? event.target.innerText : event.target.checked;
|
||||
const appNotificationPreference = appPreferences.find(preference => preference.id === notificationType);
|
||||
const value = notificationChannel === 'email_cadence' && courseId ? event.target.innerText : event.target.checked;
|
||||
const emailCadence = notificationChannel === 'email_cadence' ? event.target.innerText : appNotificationPreference.emailCadence;
|
||||
|
||||
dispatch(updatePreferenceToggle(
|
||||
courseId,
|
||||
@@ -36,9 +38,10 @@ const NotificationPreferenceColumn = ({ appId, channel, appPreference }) => {
|
||||
notificationType,
|
||||
notificationChannel,
|
||||
value,
|
||||
emailCadence !== 'Mixed' ? emailCadence : undefined,
|
||||
));
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [appId]);
|
||||
}, [appId, appPreferences]);
|
||||
|
||||
const renderPreference = (preference) => (
|
||||
(preference?.coreNotificationTypes?.length > 0 || preference.id !== 'core') && (
|
||||
|
||||
Reference in New Issue
Block a user