diff options
author | unarist <m.unarist@gmail.com> | 2018-03-27 20:05:59 +0900 |
---|---|---|
committer | Eugen Rochko <eugen@zeonfederated.com> | 2018-03-27 13:05:59 +0200 |
commit | 2f3ac14a434c773577771b74292aa313d57db3c9 (patch) | |
tree | 824b74b1df45dc5a5c7413a0a2f82879e6d6f877 | |
parent | ca42f9b0ebfa1f4e8e86745a79af138b5865daee (diff) |
Add missing null handling in notification reducer (#6930)
This patch adds null item (i.e. gap) handling on below functions to avoid TypeError. * `filterNotifications` called on user mute/block * `deleteByStatus` called on status deletion
-rw-r--r-- | app/javascript/mastodon/reducers/notifications.js | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/app/javascript/mastodon/reducers/notifications.js b/app/javascript/mastodon/reducers/notifications.js index f023984b8..1ac7eb706 100644 --- a/app/javascript/mastodon/reducers/notifications.js +++ b/app/javascript/mastodon/reducers/notifications.js @@ -82,7 +82,7 @@ const expandNormalizedNotifications = (state, notifications, next) => { }; const filterNotifications = (state, relationship) => { - return state.update('items', list => list.filterNot(item => item.get('account') === relationship.id)); + return state.update('items', list => list.filterNot(item => item !== null && item.get('account') === relationship.id)); }; const updateTop = (state, top) => { @@ -94,7 +94,7 @@ const updateTop = (state, top) => { }; const deleteByStatus = (state, statusId) => { - return state.update('items', list => list.filterNot(item => item.get('status') === statusId)); + return state.update('items', list => list.filterNot(item => item !== null && item.get('status') === statusId)); }; export default function notifications(state = initialState, action) { |