Changeset View
Changeset View
Standalone View
Standalone View
lib/reducers/user-reducer.js
Show All 33 Lines | |||||
import type { | import type { | ||||
CurrentUserInfo, | CurrentUserInfo, | ||||
UserStore, | UserStore, | ||||
UserInfos, | UserInfos, | ||||
} from '../types/user-types.js'; | } from '../types/user-types.js'; | ||||
import { actionLogger } from '../utils/action-logger.js'; | import { actionLogger } from '../utils/action-logger.js'; | ||||
import { setNewSessionActionType } from '../utils/action-utils.js'; | import { setNewSessionActionType } from '../utils/action-utils.js'; | ||||
import { getConfig } from '../utils/config.js'; | import { getConfig } from '../utils/config.js'; | ||||
import { generateReportID } from '../utils/report-utils.js'; | |||||
import { sanitizeActionSecrets } from '../utils/sanitization.js'; | import { sanitizeActionSecrets } from '../utils/sanitization.js'; | ||||
function reduceCurrentUserInfo( | function reduceCurrentUserInfo( | ||||
state: ?CurrentUserInfo, | state: ?CurrentUserInfo, | ||||
action: BaseAction, | action: BaseAction, | ||||
): ?CurrentUserInfo { | ): ?CurrentUserInfo { | ||||
if ( | if ( | ||||
action.type === logInActionTypes.success || | action.type === logInActionTypes.success || | ||||
▲ Show 20 Lines • Show All 86 Lines • ▼ Show 20 Lines | return [ | ||||
{ | { | ||||
type: reportTypes.USER_INCONSISTENCY, | type: reportTypes.USER_INCONSISTENCY, | ||||
platformDetails: getConfig().platformDetails, | platformDetails: getConfig().platformDetails, | ||||
action: sanitizeActionSecrets(action), | action: sanitizeActionSecrets(action), | ||||
beforeStateCheck, | beforeStateCheck, | ||||
afterStateCheck, | afterStateCheck, | ||||
lastActions: actionLogger.interestingActionSummaries, | lastActions: actionLogger.interestingActionSummaries, | ||||
time: Date.now(), | time: Date.now(), | ||||
id: generateReportID(), | |||||
}, | }, | ||||
]; | ]; | ||||
} | } | ||||
function reduceUserInfos(state: UserStore, action: BaseAction): UserStore { | function reduceUserInfos(state: UserStore, action: BaseAction): UserStore { | ||||
if ( | if ( | ||||
action.type === joinThreadActionTypes.success || | action.type === joinThreadActionTypes.success || | ||||
action.type === newThreadActionTypes.success | action.type === newThreadActionTypes.success | ||||
▲ Show 20 Lines • Show All 111 Lines • Show Last 20 Lines |