Page MenuHomePhabricator

lib] Refactor message reducer
ClosedPublic

Authored by inka on Jan 16 2024, 7:42 AM.
Tags
None
Referenced Files
F3389463: D10653.id35674.diff
Fri, Nov 29, 7:15 PM
Unknown Object (File)
Tue, Nov 26, 8:58 AM
Unknown Object (File)
Mon, Nov 18, 8:46 AM
Unknown Object (File)
Wed, Nov 6, 1:15 PM
Unknown Object (File)
Oct 18 2024, 2:45 AM
Unknown Object (File)
Oct 15 2024, 8:41 AM
Unknown Object (File)
Oct 14 2024, 6:45 PM
Unknown Object (File)
Oct 14 2024, 6:45 PM
Subscribers

Details

Summary

issue: ENG-5766
MessageStore looks like this:

export type MessageStore = {
  +messages: { +[id: string]: RawMessageInfo },
  +threads: MessageStoreThreads,
  +local: { +[id: string]: LocalMessageInfo },
  +currentAsOf: { +[keyserverID: string]: number },
};

messages, local and threads are filtered by updateMessageStoreWithLatestThreadInfos/processMessageStoreOperations based on what threads were removed by thread reducer. I only need to update currentAsOf.

Test Plan

Tested that if a user logs out of one keyserver all data related to this keyserver is wiped from MessageStore

Diff Detail

Repository
rCOMM Comm
Branch
inka/login_reducers
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

inka requested review of this revision.Jan 16 2024, 8:01 AM
lib/reducers/message-reducer.js
853

As mentioned in other diffs, I'm not sure if we need to change anything for logOutActionTypes.success

This comment was removed by inka.
inka planned changes to this revision.Jan 17 2024, 8:17 AM

We decided to have a single action for logging out of keyservers and identity.

Because we decided to merge logout from keyservers with logout from identity, all keyservers will be removed on logut, so we want to remove them all from currenAsOf. In case of deleteKeyserverAccountActionTypes action.payload.keyserverIDs will be defined, so we will only remove those keyservers.
I tested that the fact that we are removing ashoats keyserver from currenAsOf doesn't break anything - when the user logs out and back in, the value gets set without any errors

Merge identity delete account with keyserver delete account

This revision is now accepted and ready to land.Jan 29 2024, 5:40 AM
lib/reducers/message-reducer.js
886 ↗(On Diff #35940)

Maybe it would be better to do this check again? If someone adds keyserverIDs to another action in the future, they might be suprised that this code will run

lib/reducers/message-reducer.js
886 ↗(On Diff #35940)

I think if someone added keyserverIDs to a payload, they would want this code to run

This revision was automatically updated to reflect the committed changes.