diff --git a/src/Notifications/data/__factories__/notifications.factory.js b/src/Notifications/data/__factories__/notifications.factory.js index f919167..29645bf 100644 --- a/src/Notifications/data/__factories__/notifications.factory.js +++ b/src/Notifications/data/__factories__/notifications.factory.js @@ -8,7 +8,7 @@ Factory.define('notificationsCount') grades: 10, authoring: 5, }) - .attr('showNotificationTray', true); + .attr('showNotificationsTray', true); Factory.define('notification') .sequence('id') diff --git a/src/Notifications/data/redux.test.js b/src/Notifications/data/redux.test.js index f17e6bf..fd19943 100644 --- a/src/Notifications/data/redux.test.js +++ b/src/Notifications/data/redux.test.js @@ -62,7 +62,7 @@ describe('Notification Redux', () => { expect(notifications.apps).toEqual({}); expect(notifications.notifications).toEqual({}); expect(notifications.tabsCount).toEqual({}); - expect(notifications.showNotificationTray).toEqual(false); + expect(notifications.showNotificationsTray).toEqual(false); expect(notifications.pagination.count).toEqual(10); expect(notifications.pagination.numPages).toEqual(1); expect(notifications.pagination.currentPage).toEqual(1); diff --git a/src/Notifications/data/selectors.js b/src/Notifications/data/selectors.js index b8d72c2..151c4f1 100644 --- a/src/Notifications/data/selectors.js +++ b/src/Notifications/data/selectors.js @@ -8,7 +8,7 @@ export const selectNotificationTabs = () => state => state.notifications.appsId; export const selectSelectedAppNotificationIds = (appName) => state => state.notifications.apps[appName] ?? []; -export const selectShowNotificationTray = () => state => state.notifications.showNotificationTray; +export const selectShowNotificationTray = () => state => state.notifications.showNotificationsTray; export const selectNotifications = () => state => state.notifications.notifications; diff --git a/src/Notifications/data/slice.js b/src/Notifications/data/slice.js index 8751475..412cc4d 100644 --- a/src/Notifications/data/slice.js +++ b/src/Notifications/data/slice.js @@ -16,7 +16,7 @@ const initialState = { apps: {}, notifications: {}, tabsCount: {}, - showNotificationTray: false, + showNotificationsTray: false, pagination: { count: 10, numPages: 1, @@ -62,12 +62,12 @@ const slice = createSlice({ }, fetchNotificationsCountSuccess: (state, { payload }) => { const { - countByAppName, appIds, apps, count, showNotificationTray, + countByAppName, appIds, apps, count, showNotificationsTray, } = payload; state.tabsCount = { count, ...countByAppName }; state.appsId = appIds; state.apps = apps; - state.showNotificationTray = showNotificationTray; + state.showNotificationsTray = showNotificationsTray; state.notificationStatus = RequestStatus.LOADED; }, markNotificationsAsSeenRequest: (state) => { diff --git a/src/Notifications/data/thunks.js b/src/Notifications/data/thunks.js index 3ffbb82..f87e2e1 100644 --- a/src/Notifications/data/thunks.js +++ b/src/Notifications/data/thunks.js @@ -27,11 +27,11 @@ import { } from './api'; import { getHttpErrorStatus } from '../utils'; -const normalizeNotificationCounts = ({ countByAppName, count, showNotificationTray }) => { +const normalizeNotificationCounts = ({ countByAppName, count, showNotificationsTray }) => { const appIds = Object.keys(countByAppName); const apps = appIds.reduce((acc, appId) => { acc[appId] = []; return acc; }, {}); return { - countByAppName, appIds, apps, count, showNotificationTray, + countByAppName, appIds, apps, count, showNotificationsTray, }; }; @@ -66,12 +66,7 @@ export const fetchAppsNotificationCount = () => ( dispatch(fetchNotificationsCountRequest()); const data = await getNotificationCounts(); const normalisedData = normalizeNotificationCounts((camelCaseObject(data))); - dispatch(fetchNotificationsCountSuccess({ - ...normalisedData, - countByAppName: data.countByAppName, - count: data.count, - showNotificationTray: data.showNotificationTray, - })); + dispatch(fetchNotificationsCountSuccess({ ...normalisedData })); } catch (error) { if (getHttpErrorStatus(error) === 403) { dispatch(fetchNotificationsCountDenied()); diff --git a/src/learning-header/AuthenticatedUserDropdown.jsx b/src/learning-header/AuthenticatedUserDropdown.jsx index 2ac7beb..0060c50 100644 --- a/src/learning-header/AuthenticatedUserDropdown.jsx +++ b/src/learning-header/AuthenticatedUserDropdown.jsx @@ -15,7 +15,7 @@ import { RequestStatus } from '../Notifications/data/slice'; import messages from './messages'; const AuthenticatedUserDropdown = ({ intl, username }) => { - const showNotificationTray = useSelector(selectShowNotificationTray()); + const showNotificationsTray = useSelector(selectShowNotificationTray()); const notificationStatus = useSelector(selectNotificationStatus()); const dispatch = useDispatch(); @@ -35,7 +35,7 @@ const AuthenticatedUserDropdown = ({ intl, username }) => { return ( <> {intl.formatMessage(messages.help)} - {showNotificationTray && } + {showNotificationsTray && }