mirror of
https://github.com/glitch-soc/mastodon.git
synced 2025-12-15 00:38:27 +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:
@@ -1,12 +1,12 @@
|
||||
import { fromJS, Map as ImmutableMap, List as ImmutableList } from 'immutable';
|
||||
|
||||
import { DOMAIN_BLOCK_SUCCESS } from 'flavours/glitch/actions/domain_blocks';
|
||||
import { blockDomainSuccess } from 'flavours/glitch/actions/domain_blocks';
|
||||
|
||||
import {
|
||||
ACCOUNT_BLOCK_SUCCESS,
|
||||
ACCOUNT_MUTE_SUCCESS,
|
||||
FOLLOW_REQUEST_AUTHORIZE_SUCCESS,
|
||||
FOLLOW_REQUEST_REJECT_SUCCESS,
|
||||
authorizeFollowRequestSuccess,
|
||||
blockAccountSuccess,
|
||||
muteAccountSuccess,
|
||||
rejectFollowRequestSuccess,
|
||||
} from '../actions/accounts';
|
||||
import {
|
||||
MARKERS_FETCH_SUCCESS,
|
||||
@@ -15,7 +15,7 @@ import {
|
||||
NOTIFICATIONS_MOUNT,
|
||||
NOTIFICATIONS_UNMOUNT,
|
||||
NOTIFICATIONS_SET_VISIBILITY,
|
||||
NOTIFICATIONS_UPDATE,
|
||||
notificationsUpdate,
|
||||
NOTIFICATIONS_EXPAND_SUCCESS,
|
||||
NOTIFICATIONS_EXPAND_REQUEST,
|
||||
NOTIFICATIONS_EXPAND_FAIL,
|
||||
@@ -316,19 +316,19 @@ export default function notifications(state = initialState, action) {
|
||||
return state.set('items', ImmutableList()).set('pendingItems', ImmutableList()).set('hasMore', true);
|
||||
case NOTIFICATIONS_SCROLL_TOP:
|
||||
return updateTop(state, action.top);
|
||||
case NOTIFICATIONS_UPDATE:
|
||||
return normalizeNotification(state, action.notification, action.usePendingItems);
|
||||
case notificationsUpdate.type:
|
||||
return normalizeNotification(state, action.payload.notification, action.payload.usePendingItems);
|
||||
case NOTIFICATIONS_EXPAND_SUCCESS:
|
||||
return expandNormalizedNotifications(state, action.notifications, action.next, action.isLoadingMore, action.isLoadingRecent, action.usePendingItems);
|
||||
case ACCOUNT_BLOCK_SUCCESS:
|
||||
return filterNotifications(state, [action.relationship.id]);
|
||||
case ACCOUNT_MUTE_SUCCESS:
|
||||
return action.relationship.muting_notifications ? filterNotifications(state, [action.relationship.id]) : state;
|
||||
case DOMAIN_BLOCK_SUCCESS:
|
||||
return filterNotifications(state, action.accounts);
|
||||
case FOLLOW_REQUEST_AUTHORIZE_SUCCESS:
|
||||
case FOLLOW_REQUEST_REJECT_SUCCESS:
|
||||
return filterNotifications(state, [action.id], 'follow_request');
|
||||
case blockAccountSuccess.type:
|
||||
return filterNotifications(state, [action.payload.relationship.id]);
|
||||
case muteAccountSuccess.type:
|
||||
return action.relationship.muting_notifications ? filterNotifications(state, [action.payload.relationship.id]) : state;
|
||||
case blockDomainSuccess.type:
|
||||
return filterNotifications(state, action.payload.accounts);
|
||||
case authorizeFollowRequestSuccess.type:
|
||||
case rejectFollowRequestSuccess.type:
|
||||
return filterNotifications(state, [action.payload.id], 'follow_request');
|
||||
case NOTIFICATIONS_CLEAR:
|
||||
return state.set('items', ImmutableList()).set('pendingItems', ImmutableList()).set('hasMore', false);
|
||||
case TIMELINE_DELETE:
|
||||
|
||||
Reference in New Issue
Block a user