]> cat aescling's git repositories - mastodon.git/commitdiff
Fix race condition causing shallow status with only a "favourited" attribute (#9272)
authorThibG <thib@sitedethib.com>
Tue, 13 Nov 2018 13:58:14 +0000 (14:58 +0100)
committerEugen Rochko <eugen@zeonfederated.com>
Tue, 13 Nov 2018 13:58:14 +0000 (14:58 +0100)
Fixes #9231

app/javascript/mastodon/reducers/statuses.js

index 6e3d830dacbc6c2544b37ffda4a68f4fe5f6cbbf..885cc221cd4d29ddb5dabffa4c207f276efa5e90 100644 (file)
@@ -38,11 +38,11 @@ export default function statuses(state = initialState, action) {
   case FAVOURITE_REQUEST:
     return state.setIn([action.status.get('id'), 'favourited'], true);
   case FAVOURITE_FAIL:
-    return state.setIn([action.status.get('id'), 'favourited'], false);
+    return state.get(action.status.get('id')) === undefined ? state : state.setIn([action.status.get('id'), 'favourited'], false);
   case REBLOG_REQUEST:
     return state.setIn([action.status.get('id'), 'reblogged'], true);
   case REBLOG_FAIL:
-    return state.setIn([action.status.get('id'), 'reblogged'], false);
+    return state.get(action.status.get('id')) === undefined ? state : state.setIn([action.status.get('id'), 'reblogged'], false);
   case STATUS_MUTE_SUCCESS:
     return state.setIn([action.id, 'muted'], true);
   case STATUS_UNMUTE_SUCCESS: