]> cat aescling's git repositories - mastodon.git/commitdiff
Fix crash when clicking “Show more/less for all” when a toot is not visible (#8118)
authorMélanie Chauvel (ariasuni) <perso@hack-libre.org>
Sat, 11 Aug 2018 09:52:53 +0000 (11:52 +0200)
committerEugen Rochko <eugen@zeonfederated.com>
Sat, 11 Aug 2018 09:52:53 +0000 (11:52 +0200)
app/javascript/mastodon/reducers/statuses.js

index 3abe69bcead081e514cf65874f18c1a22fc922b4..6e3d830dacbc6c2544b37ffda4a68f4fe5f6cbbf 100644 (file)
@@ -49,11 +49,19 @@ export default function statuses(state = initialState, action) {
     return state.setIn([action.id, 'muted'], false);
   case STATUS_REVEAL:
     return state.withMutations(map => {
-      action.ids.forEach(id => map.setIn([id, 'hidden'], false));
+      action.ids.forEach(id => {
+        if (!(state.get(id) === undefined)) {
+          map.setIn([id, 'hidden'], false);
+        }
+      });
     });
   case STATUS_HIDE:
     return state.withMutations(map => {
-      action.ids.forEach(id => map.setIn([id, 'hidden'], true));
+      action.ids.forEach(id => {
+        if (!(state.get(id) === undefined)) {
+          map.setIn([id, 'hidden'], true);
+        }
+      });
     });
   case TIMELINE_DELETE:
     return deleteStatus(state, action.id, action.references);