Can't deny a granted permission, PermissionOverride resource left in bad state #767
Closed
4 tasks done
Labels
bug
level: novice
is doable as a java/jda novice
priority: low
status: completed
has been completed but is not yet released
General Troubleshooting
Hey there! Before you report a bug or suggest a new feature,
please make sure to follow these steps first!
Issue
Issue Type
Description
There seems to be a bug in how permissions are denied with the PermOverrideManager.
Creating a PO, then granting a permission (example: Attach Files), and then denying it again leaves the PermissionOverride in a bad state where the raw values of denied and allowed permissions are both containing the raw value of the permission in question. The Discord API will happily accept a raw value in both denied and allowed bitmasks, but will assume that the permission is allowed, making it impossible to deny the permission via JDA in this way.
Here's a JS eval to reproduce this:
Giving the following output:
The correct output should have been
I traced this issue down to the
PermOverrideManager#finalizeData
method.When entering that method, the internal fields
allowed
anddenied
have the correct values (allowed
being 0 anddenied
being 32768), but then this method callsPermOverrideManager#setupValues
, which changes the value of theallowed
field to contain 32768 instead of 0.The text was updated successfully, but these errors were encountered: