]> cat aescling's git repositories - mastodon.git/commitdiff
Fix notifications reducer bug
authorEugen Rochko <eugen@zeonfederated.com>
Thu, 22 Dec 2016 10:23:30 +0000 (11:23 +0100)
committerEugen Rochko <eugen@zeonfederated.com>
Thu, 22 Dec 2016 10:23:30 +0000 (11:23 +0100)
app/assets/javascripts/components/actions/notifications.jsx
app/assets/javascripts/components/reducers/accounts.jsx

index a03f88af13341047aaeb6853d2f4524d2fed23d6..6a8b1b05b689795fe4efda1f27411a1787be8f4d 100644 (file)
@@ -76,7 +76,7 @@ export function refreshNotificationsSuccess(notifications, next) {
     type: NOTIFICATIONS_REFRESH_SUCCESS,
     notifications,
     accounts: notifications.map(item => item.account),
-    statuses: notifications.map(item => item.status),
+    statuses: notifications.map(item => item.status).filter(status => !!status),
     next
   };
 };
@@ -120,7 +120,7 @@ export function expandNotificationsSuccess(notifications, next) {
     type: NOTIFICATIONS_EXPAND_SUCCESS,
     notifications,
     accounts: notifications.map(item => item.account),
-    statuses: notifications.map(item => item.status),
+    statuses: notifications.map(item => item.status).filter(status => !!status),
     next
   };
 };
index 52be648b3e956ef450ac337253cfba38844ac0a5..982e63073bc6adcae82bdef65fcf8fdf548354f9 100644 (file)
@@ -78,9 +78,10 @@ export default function accounts(state = initialState, action) {
     case FAVOURITES_FETCH_SUCCESS:
     case COMPOSE_SUGGESTIONS_READY:
     case SEARCH_SUGGESTIONS_READY:
+      return normalizeAccounts(state, action.accounts);
     case NOTIFICATIONS_REFRESH_SUCCESS:
     case NOTIFICATIONS_EXPAND_SUCCESS:
-      return normalizeAccounts(state, action.accounts);
+      return normalizeAccountsFromStatuses(normalizeAccounts(state, action.accounts), action.statuses);
     case TIMELINE_REFRESH_SUCCESS:
     case TIMELINE_EXPAND_SUCCESS:
     case ACCOUNT_TIMELINE_FETCH_SUCCESS: