Page MenuHomePhabricator

[native] Introduce `recursivelyUpdatePermissions(ThreadTraversalNode)`
ClosedPublic

Authored by atul on Apr 25 2023, 1:41 AM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Nov 4, 5:41 AM
Unknown Object (File)
Thu, Oct 31, 4:32 PM
Unknown Object (File)
Thu, Oct 31, 4:32 PM
Unknown Object (File)
Thu, Oct 31, 4:32 PM
Unknown Object (File)
Thu, Oct 31, 4:32 PM
Unknown Object (File)
Thu, Oct 31, 4:32 PM
Unknown Object (File)
Thu, Oct 31, 4:30 PM
Unknown Object (File)
Oct 5 2024, 9:31 PM
Subscribers

Details

Summary

We introduce recursivelyUpdatePermissions(ThreadTraversalNode, memberToThreadPermissionsFromParent) which traverses node and all children recursively to update member.permissions.

memberToThreadPermissionsFromParent is a map from userID to permissionsFromParent (?ThreadPermissionsBlob). Each node calculates makePermissionsForChildrenBlob for each member and populates memberToThreadPermissionsFromParent. memberToThreadPermissionsFromParent is then passed in as an argument for recursive call for each child. The child will call makePermissionsBlob with both rolePermissions and permissionsFromParent to compute the aggregate permissions that will be stored in member.permissions.


Depends on D7601

Test Plan

Ran with correct threadStore from keyserver (devDB) and ensured that it remained the same.

Also removed all member.permissions from threadStore and ensured that recursivelyUpdatePermissions was able to compute all member.permissions "from scratch" (AKA not depending on any existing member.permissions. There are unit tests for this included in the diff.

WARNING: HOWEVER, I did run into some issues when testing against my prod threadStore. I specifically had issues with threadID: 892819 on prod. I might need to sync w/ @ashoat on this one to figure out where the issue is.

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

atul requested review of this revision.Apr 25 2023, 1:59 AM
ashoat added inline comments.
native/redux/update-roles-and-permissions.js
113 ↗(On Diff #25647)

Nit: can we make this forEach instead of map?

This revision is now accepted and ready to land.Apr 25 2023, 4:08 AM

resolve merge conflicts and address feedback

This revision was landed with ongoing or failed builds.Apr 25 2023, 12:53 PM
This revision was automatically updated to reflect the committed changes.