Page MenuHomePhabricator

lib] Refactor message reducer
ClosedPublic

Authored by inka on Jan 16 2024, 7:42 AM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Sep 4, 5:18 AM
Unknown Object (File)
Tue, Sep 3, 9:27 AM
Unknown Object (File)
Fri, Aug 30, 10:20 PM
Unknown Object (File)
Aug 28 2024, 6:55 AM
Unknown Object (File)
Aug 27 2024, 9:12 PM
Unknown Object (File)
Aug 26 2024, 3:36 AM
Unknown Object (File)
Aug 22 2024, 8:54 AM
Unknown Object (File)
Aug 5 2024, 2:17 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
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

inka requested review of this revision.Jan 16 2024, 8:01 AM
lib/reducers/message-reducer.js
853 ↗(On Diff #35674)

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.