Updated frontend notification filtering and configuration

• Updated:
- frontend notification filtering and configuration

• Added:
- lastReadNotificationId to initial_state
- minWidth20PX for responsive notification icon hiding on xs

• Removed:
- unused code
This commit is contained in:
mgabdev
2020-05-21 15:37:40 -04:00
parent 83696f8098
commit 663f46b166
8 changed files with 245 additions and 264 deletions

View File

@@ -140,7 +140,7 @@ const excludeTypesFromFilter = filter => {
return allTypes.filterNot(item => item === filter).toJS();
};
const noOp = () => { };
const noOp = () => {}
export function expandNotifications({ maxId } = {}, done = noOp) {
return (dispatch, getState) => {
@@ -252,17 +252,20 @@ export function setFilter(path, value) {
export function markReadNotifications() {
return (dispatch, getState) => {
if (!me) return;
const top_notification = parseInt(getState().getIn(['notifications', 'items', 0, 'id']));
const last_read = getState().getIn(['notifications', 'lastRead']);
if (!me) return
const topNotification = parseInt(getState().getIn(['notifications', 'items', 0, 'id']))
const lastReadId = getState().getIn(['notifications', 'lastReadId'])
if (top_notification && top_notification > last_read) {
api(getState).post('/api/v1/notifications/mark_read', { id: top_notification }).then(response => {
if (topNotification && topNotification > lastReadId && lastReadId !== -1) {
api(getState).post('/api/v1/notifications/mark_read', {
id: topNotification
}).then(() => {
dispatch({
type: NOTIFICATIONS_MARK_READ,
notification: top_notification,
});
});
notification: topNotification,
})
})
}
}
};
}