Page MenuHomePhabricator

[lib] Pull `filterOutDisabledPermissions(permissionsBitmask)` out of `getCurrentUser`
ClosedPublic

Authored by atul on Apr 23 2024, 10:55 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Oct 26, 1:01 AM
Unknown Object (File)
Sat, Oct 12, 4:30 PM
Unknown Object (File)
Sat, Oct 12, 4:30 PM
Unknown Object (File)
Sat, Oct 12, 4:30 PM
Unknown Object (File)
Sat, Oct 12, 4:29 PM
Unknown Object (File)
Sat, Oct 12, 4:29 PM
Unknown Object (File)
Sep 20 2024, 10:26 PM
Unknown Object (File)
Sep 20 2024, 10:16 PM
Subscribers

Details

Summary

We will need to use this logic at permission check sites (eg threadMemberHasPermission/threadHasPermission/etc). Eventually we'll consolidate so we use one hook for everything, but for now we're going to use this in a couple places so we can first remove usage from getCurrentUser.


Depends on D11741

Test Plan

This is a very simple extract/move diff. flow + careful reading + will be tested implicitly by later diffs in the stack.

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

atul requested review of this revision.Apr 23 2024, 11:11 AM
tomek added inline comments.
lib/shared/thread-utils.js
993 ↗(On Diff #39418)

This function name sounds confusing. We receive a permissions bitmask, decode it, add more permissions to it, and encode. So we're adding some permissions instead of filtering some out.

This revision is now accepted and ready to land.Apr 24 2024, 4:29 AM
lib/shared/thread-utils.js
993 ↗(On Diff #39418)

We're not adding more permissions, but we could potentially be adding more permission entries.

We're overriding value of permissions in decodedPermission (if they exist) with { value: false, source: null } if the key/permission is also in disabledPermissions:

851623.png (446×2 px, 92 KB)


So we're effectively filtering out permissions, but could also name this something like patchDisabledPermissions or patchPermissionsBitmaskForBlock or something like that? If that would be preferred I can create a followup diff doing that rename. I think current name makes sense for now.

This revision was landed with ongoing or failed builds.Apr 24 2024, 12:38 PM
This revision was automatically updated to reflect the committed changes.