MCPcopy Create free account
hub / github.com/CommE2E/comm / invalidSessionRecovery

Function invalidSessionRecovery

lib/shared/session-utils.js:86–110  ·  view source on GitHub ↗
(
  currentReduxState: AppState,
  actionCurrentUserInfo: ?CurrentUserInfo,
  authActionSource: ?AuthActionSource,
)

Source from the content-addressed store, hash-verified

84 Object.values(recoveryFromReduxActionSources),
85);
86function invalidSessionRecovery(
87 currentReduxState: AppState,
88 actionCurrentUserInfo: ?CurrentUserInfo,
89 authActionSource: ?AuthActionSource,
90): boolean {
91 if (
92 !authActionSource ||
93 !actionSourcesCheckedForInvalidSessionRecovery.has(authActionSource)
94 ) {
95 return false;
96 }
97 invariant(
98 actionCurrentUserInfo,
99 'actionCurrentUserInfo should be passed to invalidSessionRecovery for ' +
100 `${authActionSource} login`,
101 );
102 if (actionCurrentUserInfo.anonymous) {
103 // It's not a session recovery if the CurrentUserInfo is anonymous
104 return false;
105 }
106 return (
107 !currentReduxState.dataLoaded ||
108 currentReduxState.currentUserInfo?.id !== actionCurrentUserInfo.id
109 );
110}
111
112export {
113 invalidSessionDowngrade,

Callers 2

reducerFunction · 0.90
reducerFunction · 0.90

Calls 1

hasMethod · 0.65

Tested by

no test coverage detected