Skip to content

Commit

Permalink
fix(PermissionOverwriteManager): mutates user (#8282)
Browse files Browse the repository at this point in the history
Fix PermissionOverwriteManager changing userOrRole

Since it's mutated the original Member object won't be passed to upset and will be seen as invalid if User cache is disabled.

Functions normally even with User cache disabled after the fix.
  • Loading branch information
AppEternal committed Jul 17, 2022
1 parent beb3d8e commit 4d86cf4
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/managers/PermissionOverwriteManager.js
Expand Up @@ -142,8 +142,9 @@ class PermissionOverwriteManager extends CachedManager {
* .catch(console.error);
*/
edit(userOrRole, options, overwriteOptions) {
userOrRole = this.channel.guild.roles.resolveId(userOrRole) ?? this.client.users.resolveId(userOrRole);
const existing = this.cache.get(userOrRole);
const existing = this.cache.get(
this.channel.guild.roles.resolveId(userOrRole) ?? this.client.users.resolveId(userOrRole),
);
return this.upsert(userOrRole, options, overwriteOptions, existing);
}

Expand Down

0 comments on commit 4d86cf4

Please sign in to comment.