Page MenuHomePhabricator

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

Authored by atul on Tue, Apr 23, 10:55 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Apr 28, 7:46 PM
Unknown Object (File)
Sun, Apr 28, 7:20 PM
Unknown Object (File)
Sun, Apr 28, 12:37 PM
Unknown Object (File)
Sat, Apr 27, 1:25 PM
F1654016: 851623.png
Wed, Apr 24, 12:22 PM
Unknown Object (File)
Tue, Apr 23, 8:58 PM
Unknown Object (File)
Tue, Apr 23, 8:57 PM
Unknown Object (File)
Tue, Apr 23, 8:55 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.Tue, Apr 23, 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.Wed, Apr 24, 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.Wed, Apr 24, 12:38 PM
This revision was automatically updated to reflect the committed changes.