mirror of
https://github.com/glitch-soc/mastodon.git
synced 2025-12-14 16:28:59 +00:00
[Glitch] Use Immutable Record for accounts in Redux state
Port 3bf2a7296e to glitch-soc
Signed-off-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
@@ -33,8 +33,8 @@ import {
|
||||
FOLLOW_REQUESTS_EXPAND_REQUEST,
|
||||
FOLLOW_REQUESTS_EXPAND_SUCCESS,
|
||||
FOLLOW_REQUESTS_EXPAND_FAIL,
|
||||
FOLLOW_REQUEST_AUTHORIZE_SUCCESS,
|
||||
FOLLOW_REQUEST_REJECT_SUCCESS,
|
||||
authorizeFollowRequestSuccess,
|
||||
rejectFollowRequestSuccess,
|
||||
} from '../actions/accounts';
|
||||
import {
|
||||
BLOCKS_FETCH_REQUEST,
|
||||
@@ -66,11 +66,7 @@ import {
|
||||
MUTES_EXPAND_SUCCESS,
|
||||
MUTES_EXPAND_FAIL,
|
||||
} from '../actions/mutes';
|
||||
import {
|
||||
NOTIFICATIONS_UPDATE,
|
||||
} from '../actions/notifications';
|
||||
|
||||
|
||||
import { notificationsUpdate } from '../actions/notifications';
|
||||
|
||||
const initialListState = ImmutableMap({
|
||||
next: null,
|
||||
@@ -163,8 +159,8 @@ export default function userLists(state = initialState, action) {
|
||||
case FAVOURITES_FETCH_FAIL:
|
||||
case FAVOURITES_EXPAND_FAIL:
|
||||
return state.setIn(['favourited_by', action.id, 'isLoading'], false);
|
||||
case NOTIFICATIONS_UPDATE:
|
||||
return action.notification.type === 'follow_request' ? normalizeFollowRequest(state, action.notification) : state;
|
||||
case notificationsUpdate.type:
|
||||
return action.payload.notification.type === 'follow_request' ? normalizeFollowRequest(state, action.payload.notification) : state;
|
||||
case FOLLOW_REQUESTS_FETCH_SUCCESS:
|
||||
return normalizeList(state, ['follow_requests'], action.accounts, action.next);
|
||||
case FOLLOW_REQUESTS_EXPAND_SUCCESS:
|
||||
@@ -175,9 +171,9 @@ export default function userLists(state = initialState, action) {
|
||||
case FOLLOW_REQUESTS_FETCH_FAIL:
|
||||
case FOLLOW_REQUESTS_EXPAND_FAIL:
|
||||
return state.setIn(['follow_requests', 'isLoading'], false);
|
||||
case FOLLOW_REQUEST_AUTHORIZE_SUCCESS:
|
||||
case FOLLOW_REQUEST_REJECT_SUCCESS:
|
||||
return state.updateIn(['follow_requests', 'items'], list => list.filterNot(item => item === action.id));
|
||||
case authorizeFollowRequestSuccess.type:
|
||||
case rejectFollowRequestSuccess.type:
|
||||
return state.updateIn(['follow_requests', 'items'], list => list.filterNot(item => item === action.payload.id));
|
||||
case BLOCKS_FETCH_SUCCESS:
|
||||
return normalizeList(state, ['blocks'], action.accounts, action.next);
|
||||
case BLOCKS_EXPAND_SUCCESS:
|
||||
|
||||
Reference in New Issue
Block a user