HomePhabricator
Diffusion Comm 1f59a307dfef

[lib][web] Fix set_new_session action corrupting keyserverStore

Description

[lib][web] Fix set_new_session action corrupting keyserverStore

Summary:
issue: https://linear.app/comm/issue/ENG-6097/set-new-session-action-for-new-keyserver-corrupts-keyserverstore
When the client calls the version or verifyInviteLink they may not yet be authenticated with that keyserver, and not have it in the store. The keyserver would send them a session change, resulting in setNewSessionActionType being dispatched, and the reducer would add the keyserver to the store but with incomplete data.
Because this action only sets a cookie and/or removes queuedActivityUpdates, we don't really need to do anything for a keyserver that is not in our store - the cookie sent by a keyserver the client is not connected to is an anonymous cookie, and we plan to remove anonymous cookies anyway, because they don't really do anything (ENG-4653).

A second change was needed in web, because the reducer in web is run before the reducers in lib, and it would also add the keyserver while trying to set a sessionID (which is just null in this case, so we also don't need to remeber it for anything).

Test Plan:
Tested that adding a keyserver on web and native doesn't result in an error anymore, and that the setNewSessionActionType doesn't add the keyserver anymore
Tested that registration flow is not broken anymore
I tested all of those by reverting D10441 and connecting to my local keyserver as the second keyserver

Reviewers: michal, kamil, ginsu, ashoat

Reviewed By: ashoat

Subscribers: tomek

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

Details

Provenance
inkaAuthored on Jan 3 2024, 1:29 AM
Reviewer
ashoat
Differential Revision
D10506: [lib][web] Fix set_new_session action corrupting keyserverStore
Parents
rCOMMdba1071473a2: [native/lib] Cleanup existing JS backup code
Branches
Unknown
Tags
Unknown