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(GuildEmojiRoleManager): bug in #remove #5666

Merged
merged 1 commit into from May 28, 2021

Conversation

iShibi
Copy link
Contributor

@iShibi iShibi commented May 24, 2021

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

This PR fixes a bug in GuildEmojiRoleManager#remove, where it wasn't removing role(s) from the emoji. This bug was a result of an oversight in #5314. Since, #keyArray is being used there on this._roles collection, the role is already an ID, doing role.id returns undefined which results in newRoles containing IDs of the roles the emoji already has. This means no filtration happened and Discord got role IDs that were already on the emoji. Therefore, the role a user wants to remove from the emoji doesn't get removed.

ℹ️: Even tho the fix could be done by just changing role.id to role, I did some refactoring by renaming some identifiers in the #remove method so that oversight like this doesn't happen again. I noticed that some other methods also need this refactorization in GuildEmojiRoleManager file. I didn't do it in order to keep the initial review of the PR easy. Let me know If I should do it or not in this PR.

Status and versioning classification:

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

@ckohen
Copy link
Member

ckohen commented May 24, 2021

I was asked to leave the name resolvedRoles in the original PR, not 100% sure why, may have been a consistency thing. I'm all for the change though.

@iCrawl iCrawl merged commit c89bdd7 into discordjs:master May 28, 2021
@iShibi iShibi deleted the fix-emoji-roles-remove branch May 30, 2021 10:24
@iCrawl iCrawl added this to the Version 13 milestone Jun 27, 2021
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.

None yet

4 participants