Skip to content

Commit

Permalink
fix(GuildChannel): clone its PermissionOverwriteManager too (#6083)
Browse files Browse the repository at this point in the history
  • Loading branch information
SpaceEEC authored Jul 10, 2021
1 parent d6c43a5 commit f72ce7c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/managers/PermissionOverwriteManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,19 @@ const { OverwriteTypes } = require('../util/Constants');
*/
class PermissionOverwriteManager extends CachedManager {
constructor(channel, iterable) {
super(channel.client, PermissionOverwrites, iterable);
super(channel.client, PermissionOverwrites);

/**
* The channel of the permission overwrite this manager belongs to
* @type {GuildChannel}
*/
this.channel = channel;

if (iterable) {
for (const item of iterable) {
this._add(item);
}
}
}

/**
Expand Down
6 changes: 6 additions & 0 deletions src/structures/GuildChannel.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,12 @@ class GuildChannel extends Channel {
}
}

_clone() {
const clone = super._clone();
clone.permissionOverwrites = new PermissionOverwriteManager(clone, this.permissionOverwrites.cache.values());
return clone;
}

/**
* The category parent of this channel
* @type {?CategoryChannel}
Expand Down

0 comments on commit f72ce7c

Please sign in to comment.