From 9f4be7857135b0327814bd22a3e8a4e7b546f7cc Mon Sep 17 00:00:00 2001 From: alxd Date: Wed, 12 Dec 2018 16:41:31 +0100 Subject: [PATCH] simplify getNotifications once frontend filtering is not needed for FilterBar --- .../mastodon/features/notifications/index.js | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/app/javascript/mastodon/features/notifications/index.js b/app/javascript/mastodon/features/notifications/index.js index c49d48f012..a28fa1cb9d 100644 --- a/app/javascript/mastodon/features/notifications/index.js +++ b/app/javascript/mastodon/features/notifications/index.js @@ -21,18 +21,12 @@ const messages = defineMessages({ }); 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 => state.getIn(['notifications', 'items']), -], (showFilterBar, allowedType, excludedTypes, notifications) => { - if (!showFilterBar || allowedType === 'all') { - // 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 - return notifications.filterNot(item => item !== null && excludedTypes.includes(item.get('type'))); - } - return notifications.filter(item => item !== null && allowedType === item.get('type')); +], (excludedTypes, notifications) => { + // 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 + return notifications.filterNot(item => item !== null && excludedTypes.includes(item.get('type'))); }); const mapStateToProps = state => ({