fix(GuildEmojiRoleManager): bug in #remove #5666
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 onthis._roles
collection, therole
is already an ID, doingrole.id
returnsundefined
which results innewRoles
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
torole
, 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 inGuildEmojiRoleManager
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: