Quellcode durchsuchen

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
master
unarist vor 6 Jahren
committed by Eugen Rochko
Ursprung
Commit
2f3ac14a43
1 geänderte Dateien mit 2 neuen und 2 gelöschten Zeilen
  1. +2
    -2
      app/javascript/mastodon/reducers/notifications.js

+ 2
- 2
app/javascript/mastodon/reducers/notifications.js Datei anzeigen

@@ -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) {


Laden…
Abbrechen
Speichern