diff --git a/src/notification-preferences/NotificationPreferenceColumn.jsx b/src/notification-preferences/NotificationPreferenceColumn.jsx index 5178fce..ff297c3 100644 --- a/src/notification-preferences/NotificationPreferenceColumn.jsx +++ b/src/notification-preferences/NotificationPreferenceColumn.jsx @@ -52,6 +52,7 @@ const NotificationPreferenceColumn = ({ appId, channel, appPreference }) => { }, [appId]); const renderPreference = (preference) => ( + (preference?.coreNotificationTypes?.length > 0 || preference.id !== 'core') && (
{ /> )}
+ ) ); return ( diff --git a/src/notification-preferences/NotificationPreferences.test.jsx b/src/notification-preferences/NotificationPreferences.test.jsx index 6dba6af..543c5cc 100644 --- a/src/notification-preferences/NotificationPreferences.test.jsx +++ b/src/notification-preferences/NotificationPreferences.test.jsx @@ -36,6 +36,7 @@ const defaultPreferences = { web: true, push: true, email: true, + coreNotificationTypes: ['new_comment'], }, { id: 'newComment', @@ -43,6 +44,7 @@ const defaultPreferences = { web: false, push: false, email: false, + coreNotificationTypes: [], }, { id: 'newAssignment', @@ -50,6 +52,7 @@ const defaultPreferences = { web: false, push: false, email: false, + coreNotificationTypes: [], }, { id: 'newGrade', @@ -57,6 +60,7 @@ const defaultPreferences = { web: false, push: false, email: false, + coreNotificationTypes: [], }, ], nonEditable: { @@ -70,9 +74,15 @@ const defaultPreferences = { const updateChannelPreferences = (toggleVal = false) => ({ preferences: [ - { id: 'core', appId: 'discussion', web: true }, - { id: 'newComment', appId: 'discussion', web: toggleVal }, - { id: 'newAssignment', appId: 'coursework', web: toggleVal }, + { + id: 'core', appId: 'discussion', web: true, coreNotificationTypes: ['new_comment'], + }, + { + id: 'newComment', appId: 'discussion', web: toggleVal, coreNotificationTypes: [], + }, + { + id: 'newAssignment', appId: 'coursework', web: toggleVal, coreNotificationTypes: [], + }, ], }); diff --git a/src/notification-preferences/NotificationTypes.jsx b/src/notification-preferences/NotificationTypes.jsx index c192e6f..2fb3795 100644 --- a/src/notification-preferences/NotificationTypes.jsx +++ b/src/notification-preferences/NotificationTypes.jsx @@ -21,6 +21,7 @@ const NotificationTypes = ({ appId }) => {
{!mobileView && {intl.formatMessage(messages.typeLabel)}} {preferences.map(preference => ( + (preference?.coreNotificationTypes?.length > 0 || preference.id !== 'core') && ( <>
{
)} + ) + ))}
); diff --git a/src/notification-preferences/data/thunks.js b/src/notification-preferences/data/thunks.js index 2e77093..6f9b110 100644 --- a/src/notification-preferences/data/thunks.js +++ b/src/notification-preferences/data/thunks.js @@ -60,6 +60,7 @@ const normalizePreferences = (responseData) => { email: preferences[appId].notificationTypes[preferenceId].email, info: preferences[appId].notificationTypes[preferenceId].info || '', emailCadence: preferences[appId].notificationTypes[preferenceId].emailCadence || EMAIL_CADENCE.DAILY, + coreNotificationTypes: preferences[appId].coreNotificationTypes || [], } )); nonEditable[appId] = preferences[appId].nonEditable;