Changeset View
Changeset View
Standalone View
Standalone View
lib/reducers/user-reducer.js
Show All 14 Lines | import { | ||||
registerActionTypes, | registerActionTypes, | ||||
setUserSettingsActionTypes, | setUserSettingsActionTypes, | ||||
updateUserAvatarActionTypes, | updateUserAvatarActionTypes, | ||||
resetUserStateActionType, | resetUserStateActionType, | ||||
} from '../actions/user-actions.js'; | } from '../actions/user-actions.js'; | ||||
import { stateSyncSpecs } from '../shared/state-sync/state-sync-specs.js'; | import { stateSyncSpecs } from '../shared/state-sync/state-sync-specs.js'; | ||||
import { updateSpecs } from '../shared/updates/update-specs.js'; | import { updateSpecs } from '../shared/updates/update-specs.js'; | ||||
import type { BaseAction } from '../types/redux-types.js'; | import type { BaseAction } from '../types/redux-types.js'; | ||||
import type { UserInconsistencyReportCreationRequest } from '../types/report-types.js'; | import type { ClientUserInconsistencyReportCreationRequest } from '../types/report-types.js'; | ||||
import { | import { | ||||
serverRequestTypes, | serverRequestTypes, | ||||
processServerRequestsActionType, | processServerRequestsActionType, | ||||
} from '../types/request-types.js'; | } from '../types/request-types.js'; | ||||
import { | import { | ||||
fullStateSyncActionType, | fullStateSyncActionType, | ||||
incrementalStateSyncActionType, | incrementalStateSyncActionType, | ||||
} from '../types/socket-types.js'; | } from '../types/socket-types.js'; | ||||
▲ Show 20 Lines • Show All 86 Lines • ▼ Show 20 Lines | ) { | ||||
state = state && state.anonymous ? state : null; | state = state && state.anonymous ? state : null; | ||||
} | } | ||||
return state; | return state; | ||||
} | } | ||||
function reduceUserInfos( | function reduceUserInfos( | ||||
state: UserStore, | state: UserStore, | ||||
action: BaseAction, | action: BaseAction, | ||||
): [UserStore, $ReadOnlyArray<UserInconsistencyReportCreationRequest>] { | ): [UserStore, $ReadOnlyArray<ClientUserInconsistencyReportCreationRequest>] { | ||||
if ( | if ( | ||||
action.type === joinThreadActionTypes.success || | action.type === joinThreadActionTypes.success || | ||||
action.type === newThreadActionTypes.success | action.type === newThreadActionTypes.success | ||||
) { | ) { | ||||
const newUserInfos = _keyBy(userInfo => userInfo.id)( | const newUserInfos = _keyBy(userInfo => userInfo.id)( | ||||
action.payload.userInfos, | action.payload.userInfos, | ||||
); | ); | ||||
const updated = { ...state.userInfos, ...newUserInfos }; | const updated = { ...state.userInfos, ...newUserInfos }; | ||||
▲ Show 20 Lines • Show All 120 Lines • Show Last 20 Lines |