Page MenuHomePhabricator

[lib] Replace `threadMemberHasPermission` logic in `appendUserInfo`
ClosedPublic

Authored by atul on May 31 2024, 3:14 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Sep 26, 2:48 PM
Unknown Object (File)
Wed, Sep 25, 11:26 PM
Unknown Object (File)
Wed, Sep 25, 11:26 PM
Unknown Object (File)
Wed, Sep 25, 11:26 PM
Unknown Object (File)
Wed, Sep 25, 11:26 PM
Unknown Object (File)
Mon, Sep 9, 10:08 AM
Unknown Object (File)
Mon, Sep 9, 10:08 AM
Unknown Object (File)
Mon, Sep 9, 10:07 AM
Subscribers
None

Details

Summary

Instead of checking KNOW_OF using threadMemberHasPermission which requires member.permissions for all members, we use the member's role permissions to determine if they have KNOW_OF.

This was the one usage of threadMemberHasPermission, so now it can be fully removed as well.


Depends on D12158

Test Plan

Added log statements at each step and ensured that values were as expected:

d7f5e7.png (1×1 px, 309 KB)

053044.png (622×2 px, 329 KB)

Diff Detail

Repository
rCOMM Comm
Branch
master
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

lib/shared/search-utils.js
76

Will remove these comments before landing.

Harbormaster returned this revision to the author for changes because remote builds failed.May 31 2024, 3:18 PM
Harbormaster failed remote builds in B29336: Diff 40816!
lib/shared/search-utils.js
93–94

Given that this is a role permission instead of computed thread permission, I probably want to use parseThreadPermissionString to check if the base permission of any role permission is KNOW_OF?

Will need to do a little more reading since I don't remember details of the role permission -> computed thread permission logic.

Would be good to hear from @ashoat/@tomek if they know off the top of their head.

atul requested review of this revision.May 31 2024, 3:32 PM
ashoat added inline comments.
lib/shared/search-utils.js
93–94

Hmm, good question. I actually don't think using parseThreadPermissionString here is necessary... looking at the code in lib/permissions/thread-permissions.js, it seems like we do that conversion when generating permissions for a child thread from a parent, and not when checking the permissions of a given thread.

A good way to confirm this would be to just check if admin and non-admin members of a community root thread in your local environment have know_of in their permissions blob, and not just eg. descendant_know_of.

This revision is now accepted and ready to land.Jun 2 2024, 1:55 PM
lib/shared/search-utils.js
93–94

A good way to confirm this would be to just check if admin and non-admin members of a community root thread in your local environment have know_of in their permissions blob, and not just eg. descendant_know_of.

Confirmed that for admin member:

a1d55b.png (308×880 px, 45 KB)

And for non-admin member:

965b58.png (582×960 px, 93 KB)

The know_of bit ( which is least significant) of binary representation was set to true.

strip out comments before landing

This revision was landed with ongoing or failed builds.Jun 11 2024, 1:22 PM
This revision was automatically updated to reflect the committed changes.