Page MenuHomePhabricator

[native] Introduce `recursivelyUpdatePermissions(ThreadTraversalNode)`
ClosedPublic

Authored by atul on Apr 25 2023, 1:41 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Jul 6, 12:43 AM
Unknown Object (File)
Wed, Jul 3, 10:18 AM
Unknown Object (File)
Tue, Jul 2, 4:21 PM
Unknown Object (File)
Tue, Jul 2, 9:16 AM
Unknown Object (File)
Tue, Jul 2, 5:53 AM
Unknown Object (File)
Thu, Jun 13, 9:22 AM
Unknown Object (File)
Wed, Jun 12, 5:08 PM
Unknown Object (File)
Wed, Jun 12, 4:47 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.