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(GuildChannel): clone its PermissionOverwriteManager too #6083

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/managers/PermissionOverwriteManager.js
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
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