Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(PermissionsOverwrites): only convert type if number #6092

Merged
merged 1 commit into from Jul 12, 2021

Conversation

MattIPv4
Copy link
Contributor

Please describe the changes this PR makes and why it should be merged:

In some situations PermissionsOverwrites#_patch was being called with an existing PermissionsOverwrites object rather than raw packet data from Discord (I observed this locally when an overwrite was removed from a channel). This meant that type was already a string, and so the enum conversion was resulting in it incorrectly being stored as a number.

This PR tweaks the patch logic in PermissionsOverwrites to ensure that the enum conversion only occurs if the data provided is a number. If it is not, it is assumed that it is already a valid string type. This ensures that PermissionsOverwrites#type is always actually a string, as documented.

Status and versioning classification:

  • Code changes have been tested against the Discord API, or there are no code changes
  • I know how to update typings and have done so, or typings don't need updating

@iCrawl iCrawl added this to the Version 13 milestone Jul 10, 2021
@iCrawl iCrawl merged commit dee5c83 into discordjs:master Jul 12, 2021
@MattIPv4 MattIPv4 deleted the fix-permissions-overwrites-type branch July 12, 2021 10:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PermissionOverwrite.type is a number when a overwrite is deleted in the oldChannel from Client#channelUpdate
4 participants