We introduce recursivelyUpdateRoles(ThreadTraversalNode) which updates threadInfo.roles.permissions corresponding to the node.threadID AND all child threads (node.children) recursively.
Depends on D7600
Differential D7601
[native] Introduce `recursivelyUpdateRoles(ThreadTraversalNode)` atul on Apr 25 2023, 1:20 AM. Authored by Tags None Referenced Files
Subscribers
Details We introduce recursivelyUpdateRoles(ThreadTraversalNode) which updates threadInfo.roles.permissions corresponding to the node.threadID AND all child threads (node.children) recursively. NOTE: We're not mutating or updating the ThreadTraversalNodes, we're simply using them for traversal. We ARE, however, mutating the threadInfos "directly" by mutating the ThreadStoreThreadInfos passed into updateRolesAndPermissions by indexing into it w/ node.threadID from the ThreadTraversalNodes.
Depends on D7600
Later in the stack I add test cases to check that recursivelyUpdateRoles makes no changes to a "correct" threadStore retrieved from the keyserver on login AND that recursivelyUpdateRoles can construct correct threadInfo.roles.permission with all existing role permissions removed (AKA can do it from scratch solely based off of getRolePermissionBlobs. WARNING: Right now we're updating roles.permissions for roles that exist for a given threadType. That means that we can handle updating of Members or Admins if they already exist for a threadType, but we CAN'T add or remove roles to threadInfo.roles... that requires the keyserver in order to generate the roleIDs. So we can't quite build up roles/permissions entirely from scratch as we can on the keyserver... though I'm not sure how likely it is that we add/remove a role for an existing thread type vs creating a new thread type. Either way, in that scenario the developer introducing the change would be responsible for ensuring there are no inconsistencies and that may involve additional work.
Diff Detail
Event TimelineComment Actions Please address inline comments before landing! If you feel strongly that the data types should not be read-only, can you please re-request review?
|