simplify getNotifications once frontend filtering is not needed for FilterBar
parent
0a9de4a2cb
commit
9f4be78571
|
@ -21,18 +21,12 @@ const messages = defineMessages({
|
||||||
});
|
});
|
||||||
|
|
||||||
const getNotifications = createSelector([
|
const getNotifications = createSelector([
|
||||||
// TODO: Remove the first two arguments and simplify
|
|
||||||
state => state.getIn(['settings', 'notifications', 'quickFilter', 'show']),
|
|
||||||
state => state.getIn(['settings', 'notifications', 'quickFilter', 'active']),
|
|
||||||
state => ImmutableList(state.getIn(['settings', 'notifications', 'shows']).filter(item => !item).keys()),
|
state => ImmutableList(state.getIn(['settings', 'notifications', 'shows']).filter(item => !item).keys()),
|
||||||
state => state.getIn(['notifications', 'items']),
|
state => state.getIn(['notifications', 'items']),
|
||||||
], (showFilterBar, allowedType, excludedTypes, notifications) => {
|
], (excludedTypes, notifications) => {
|
||||||
if (!showFilterBar || allowedType === 'all') {
|
// used if user changed the notification settings after loading the notifications from the server
|
||||||
// used if user changed the notification settings after loading the notifications from the server
|
// otherwise a list of notifications will come pre-filtered from the backend
|
||||||
// otherwise a list of notifications will come pre-filtered from the backend
|
return notifications.filterNot(item => item !== null && excludedTypes.includes(item.get('type')));
|
||||||
return notifications.filterNot(item => item !== null && excludedTypes.includes(item.get('type')));
|
|
||||||
}
|
|
||||||
return notifications.filter(item => item !== null && allowedType === item.get('type'));
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const mapStateToProps = state => ({
|
const mapStateToProps = state => ({
|
||||||
|
|
Loading…
Reference in New Issue