Lint - separated commit to make the next diff clearer
This commit is contained in:
parent
35955f067d
commit
2e49421960
2 changed files with 13 additions and 11 deletions
|
@ -45,7 +45,7 @@ export function doNotificationList() {
|
||||||
return (dispatch: Dispatch) => {
|
return (dispatch: Dispatch) => {
|
||||||
dispatch({ type: ACTIONS.NOTIFICATION_LIST_STARTED });
|
dispatch({ type: ACTIONS.NOTIFICATION_LIST_STARTED });
|
||||||
return Lbryio.call('notification', 'list', { is_app_readable: true })
|
return Lbryio.call('notification', 'list', { is_app_readable: true })
|
||||||
.then(response => {
|
.then((response) => {
|
||||||
const notifications = response || [];
|
const notifications = response || [];
|
||||||
const channelsToResolve = notifications
|
const channelsToResolve = notifications
|
||||||
.filter((notification: WebNotification) => {
|
.filter((notification: WebNotification) => {
|
||||||
|
@ -59,7 +59,7 @@ export function doNotificationList() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.map(notification => {
|
.map((notification) => {
|
||||||
if (notification.notification_rule === NOTIFICATIONS.NEW_CONTENT) {
|
if (notification.notification_rule === NOTIFICATIONS.NEW_CONTENT) {
|
||||||
return notification.notification_parameters.device.target;
|
return notification.notification_parameters.device.target;
|
||||||
} else {
|
} else {
|
||||||
|
@ -70,7 +70,7 @@ export function doNotificationList() {
|
||||||
dispatch(doResolveUris(channelsToResolve));
|
dispatch(doResolveUris(channelsToResolve));
|
||||||
dispatch({ type: ACTIONS.NOTIFICATION_LIST_COMPLETED, data: { notifications } });
|
dispatch({ type: ACTIONS.NOTIFICATION_LIST_COMPLETED, data: { notifications } });
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch((error) => {
|
||||||
dispatch({ type: ACTIONS.NOTIFICATION_LIST_FAILED, data: { error } });
|
dispatch({ type: ACTIONS.NOTIFICATION_LIST_FAILED, data: { error } });
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -83,8 +83,8 @@ export function doReadNotifications() {
|
||||||
const unreadNotifications =
|
const unreadNotifications =
|
||||||
notifications &&
|
notifications &&
|
||||||
notifications
|
notifications
|
||||||
.filter(notification => !notification.is_read)
|
.filter((notification) => !notification.is_read)
|
||||||
.map(notification => notification.id)
|
.map((notification) => notification.id)
|
||||||
.join(',');
|
.join(',');
|
||||||
|
|
||||||
dispatch({ type: ACTIONS.NOTIFICATION_READ_STARTED });
|
dispatch({ type: ACTIONS.NOTIFICATION_READ_STARTED });
|
||||||
|
@ -92,7 +92,7 @@ export function doReadNotifications() {
|
||||||
.then(() => {
|
.then(() => {
|
||||||
dispatch({ type: ACTIONS.NOTIFICATION_READ_COMPLETED });
|
dispatch({ type: ACTIONS.NOTIFICATION_READ_COMPLETED });
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch((error) => {
|
||||||
dispatch({ type: ACTIONS.NOTIFICATION_READ_FAILED, data: { error } });
|
dispatch({ type: ACTIONS.NOTIFICATION_READ_FAILED, data: { error } });
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -110,7 +110,7 @@ export function doSeeNotifications(notificationIds: Array<string>) {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch((error) => {
|
||||||
dispatch({ type: ACTIONS.NOTIFICATION_SEEN_FAILED, data: { error } });
|
dispatch({ type: ACTIONS.NOTIFICATION_SEEN_FAILED, data: { error } });
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -121,7 +121,8 @@ export function doSeeAllNotifications() {
|
||||||
const state = getState();
|
const state = getState();
|
||||||
const notifications = selectNotifications(state);
|
const notifications = selectNotifications(state);
|
||||||
const unSeenNotifications =
|
const unSeenNotifications =
|
||||||
notifications && notifications.filter(notification => !notification.is_seen).map(notification => notification.id);
|
notifications &&
|
||||||
|
notifications.filter((notification) => !notification.is_seen).map((notification) => notification.id);
|
||||||
|
|
||||||
dispatch(doSeeNotifications(unSeenNotifications));
|
dispatch(doSeeNotifications(unSeenNotifications));
|
||||||
};
|
};
|
||||||
|
|
|
@ -55,7 +55,8 @@ export default handleActions(
|
||||||
},
|
},
|
||||||
[ACTIONS.NOTIFICATION_READ_COMPLETED]: (state, action) => {
|
[ACTIONS.NOTIFICATION_READ_COMPLETED]: (state, action) => {
|
||||||
const { notifications } = state;
|
const { notifications } = state;
|
||||||
const newNotifications = notifications && notifications.map(notification => ({ ...notification, is_read: true }));
|
const newNotifications =
|
||||||
|
notifications && notifications.map((notification) => ({ ...notification, is_read: true }));
|
||||||
return {
|
return {
|
||||||
...state,
|
...state,
|
||||||
notifications: newNotifications,
|
notifications: newNotifications,
|
||||||
|
@ -69,7 +70,7 @@ export default handleActions(
|
||||||
[ACTIONS.NOTIFICATION_SEEN_COMPLETED]: (state, action) => {
|
[ACTIONS.NOTIFICATION_SEEN_COMPLETED]: (state, action) => {
|
||||||
const { notifications } = state;
|
const { notifications } = state;
|
||||||
const { notificationIds } = action.data;
|
const { notificationIds } = action.data;
|
||||||
const newNotifications = notifications.map(notification => {
|
const newNotifications = notifications.map((notification) => {
|
||||||
if (notificationIds.includes(notification.id)) {
|
if (notificationIds.includes(notification.id)) {
|
||||||
return { ...notification, is_seen: true };
|
return { ...notification, is_seen: true };
|
||||||
}
|
}
|
||||||
|
@ -85,7 +86,7 @@ export default handleActions(
|
||||||
[ACTIONS.NOTIFICATION_DELETE_COMPLETED]: (state, action) => {
|
[ACTIONS.NOTIFICATION_DELETE_COMPLETED]: (state, action) => {
|
||||||
const { notifications } = state;
|
const { notifications } = state;
|
||||||
const { notificationId } = action.data;
|
const { notificationId } = action.data;
|
||||||
const newNotifications = notifications.filter(notification => {
|
const newNotifications = notifications.filter((notification) => {
|
||||||
return notification.id !== notificationId;
|
return notification.id !== notificationId;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue