Interactions: optimistic unreblogs

Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
strip-front-mentions
marcin mikołajczak 2022-01-04 16:57:01 +01:00
rodzic cd4e33a8ed
commit c36a47fd17
1 zmienionych plików z 6 dodań i 0 usunięć

Wyświetl plik

@ -1,6 +1,8 @@
import {
REBLOG_REQUEST,
REBLOG_FAIL,
UNREBLOG_REQUEST,
UNREBLOG_FAIL,
FAVOURITE_REQUEST,
UNFAVOURITE_REQUEST,
FAVOURITE_FAIL,
@ -91,6 +93,10 @@ export default function statuses(state = initialState, action) {
return state.setIn([action.status.get('id'), 'reblogged'], true);
case REBLOG_FAIL:
return state.get(action.status.get('id')) === undefined ? state : state.setIn([action.status.get('id'), 'reblogged'], false);
case UNREBLOG_REQUEST:
return state.setIn([action.status.get('id'), 'reblogged'], false);
case UNREBLOG_FAIL:
return state.get(action.status.get('id')) === undefined ? state : state.setIn([action.status.get('id'), 'reblogged'], true);
case STATUS_MUTE_SUCCESS:
return state.setIn([action.id, 'muted'], true);
case STATUS_UNMUTE_SUCCESS: