[Glitch] Fix race condition when interacting with deleted toots

Port c875f19673 to glitch-soc
This commit is contained in:
Thibaut Girka 2018-11-13 16:30:07 +01:00
parent bfe2b9cc50
commit 6ce7e74b46

View file

@ -118,15 +118,15 @@ export default function statuses(state = initialState, action) {
case FAVOURITE_REQUEST: case FAVOURITE_REQUEST:
return state.setIn([action.status.get('id'), 'favourited'], true); return state.setIn([action.status.get('id'), 'favourited'], true);
case FAVOURITE_FAIL: 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 BOOKMARK_REQUEST: case BOOKMARK_REQUEST:
return state.setIn([action.status.get('id'), 'bookmarked'], true); return state.setIn([action.status.get('id'), 'bookmarked'], true);
case BOOKMARK_FAIL: case BOOKMARK_FAIL:
return state.setIn([action.status.get('id'), 'bookmarked'], false); return state.get(action.status.get('id')) === undefined ? state : state.setIn([action.status.get('id'), 'bookmarked'], false);
case REBLOG_REQUEST: case REBLOG_REQUEST:
return state.setIn([action.status.get('id'), 'reblogged'], true); return state.setIn([action.status.get('id'), 'reblogged'], true);
case REBLOG_FAIL: 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: case STATUS_MUTE_SUCCESS:
return state.setIn([action.id, 'muted'], true); return state.setIn([action.id, 'muted'], true);
case STATUS_UNMUTE_SUCCESS: case STATUS_UNMUTE_SUCCESS: