HomePhabricator
Diffusion Comm 8801bf51e987

[lib][web] Update condition for Redux state reset in SET_NEW_SESSION reducers

Description

[lib][web] Update condition for Redux state reset in SET_NEW_SESSION reducers

Summary:
We have some logic in reducers to special-case SET_NEW_SESSION when a cookie is invalidated.

This diff introduces three changes:

  1. Now that we have authoritativeKeyserverID, I figured we should check it. The only time a SET_NEW_SESSION should lead to a state reset is when it's for the authoritative keyserver.
  2. I changed it from checking usingCommServicesAccessToken to checking relyingOnAuthoritativeKeyserver. As long as we rely on an authoritative keyserver, we'll wait until we auth with it before logging the user in. As such, we should treat a deauth with the authoritative keyserver as a logout, and reset the state in that case.
  3. I added a check for relyingOnAuthoritativeKeyserver to reduceCurrentUserInfo, which already had the authoritativeKeyserverID check.

Separately, something I'm wondering about... in some cases we check action.payload.sessionChange.cookieInvalidated, and in others we check action.payload.sessionChange.currentUserInfo?.anonymous. Is there any difference in these checks? Should we unify them? Wanted to ask @inka as they have touched this code recently and probably made the same observation.

Depends on D11228

Test Plan: I used this test plan for the whole stack: https://gist.github.com/Ashoat/75ab690d5c53cdd68a51b02e03e27c58

Reviewers: inka, tomek

Reviewed By: inka

Subscribers: inka

Differential Revision: https://phab.comm.dev/D11229

Details

Provenance
ashoatAuthored on Mar 3 2024, 1:06 PM
Reviewer
inka
Differential Revision
D11229: [lib][web] Update condition for Redux state reset in SET_NEW_SESSION reducers
Parents
rCOMM929d6bfcb0f0: [lib] Introduce relyingOnAuthoritativeKeyserver constant
Branches
Unknown
Tags
Unknown