TP-22455 | notification fixes (#213)

This commit is contained in:
Aman Chaturvedi
2023-04-05 23:34:22 +05:30
committed by GitHub Enterprise
parent d0c8ce6509
commit cf994f46e4

View File

@@ -91,12 +91,14 @@ const NotificationsSlice = createSlice({
},
addActionToNotifications: (state, action) => {
const actionPayload = action.payload;
let readNotificationCount = 0;
actionPayload.forEach((action: INotificationAction) => {
const { id } = action;
const index = state.data.findIndex(
notification => notification.id === id,
);
if (index !== -1) {
readNotificationCount++;
state.data[index].actions = [
{
widgetStatus: WidgetStatus.CLICKED,
@@ -104,6 +106,7 @@ const NotificationsSlice = createSlice({
];
}
});
state.totalUnreadElements = state.totalUnreadElements - readNotificationCount;
state.notificationsWithActions = [];
},
setNotificationsLoading: (state, action) => {