From ec53966775fcc95afe828234fe203f0a462889dd Mon Sep 17 00:00:00 2001 From: DraftProducts Date: Sun, 15 Aug 2021 14:37:44 +0200 Subject: [PATCH 1/5] =?UTF-8?q?fix(GuildChannel):=20=F0=9F=90=9B=20Fix=20m?= =?UTF-8?q?anageable=20method=20for=20voice-channels?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Sugden <28943913+NotSugden@users.noreply.github.com> --- src/structures/GuildChannel.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/structures/GuildChannel.js b/src/structures/GuildChannel.js index b706ffa393c6..f4dfdaa68745 100644 --- a/src/structures/GuildChannel.js +++ b/src/structures/GuildChannel.js @@ -511,12 +511,13 @@ class GuildChannel extends Channel { */ get manageable() { if (this.client.user.id === this.guild.ownerId) return true; + if (!this.viewable) { + return false; + } if (VoiceBasedChannelTypes.includes(this.type)) { if (!this.permissionsFor(this.client.user).has(Permissions.FLAGS.CONNECT, false)) { return false; } - } else if (!this.viewable) { - return false; } return this.permissionsFor(this.client.user).has(Permissions.FLAGS.MANAGE_CHANNELS, false); } From dd948d1c503763884c05be464bf587a27dc9ce0f Mon Sep 17 00:00:00 2001 From: DraftProducts Date: Sun, 15 Aug 2021 14:42:39 +0200 Subject: [PATCH 2/5] =?UTF-8?q?refactor:=20=E2=99=BB=EF=B8=8F=20Clean=20vo?= =?UTF-8?q?ice=20channel=20verification?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/structures/GuildChannel.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/structures/GuildChannel.js b/src/structures/GuildChannel.js index f4dfdaa68745..9c06bbfc1c06 100644 --- a/src/structures/GuildChannel.js +++ b/src/structures/GuildChannel.js @@ -514,10 +514,11 @@ class GuildChannel extends Channel { if (!this.viewable) { return false; } - if (VoiceBasedChannelTypes.includes(this.type)) { - if (!this.permissionsFor(this.client.user).has(Permissions.FLAGS.CONNECT, false)) { - return false; - } + if ( + VoiceBasedChannelTypes.includes(this.type) && + !this.permissionsFor(this.client.user).has(Permissions.FLAGS.CONNECT, false) + ) { + return false; } return this.permissionsFor(this.client.user).has(Permissions.FLAGS.MANAGE_CHANNELS, false); } From 85139a17736f9113072c0535594a97f1103f8a7e Mon Sep 17 00:00:00 2001 From: DraftProducts Date: Sun, 15 Aug 2021 18:47:12 +0200 Subject: [PATCH 3/5] =?UTF-8?q?refactor:=20=E2=99=BB=EF=B8=8F=20Refactor?= =?UTF-8?q?=20of=20verifications?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Sugden <28943913+NotSugden@users.noreply.github.com> --- src/structures/GuildChannel.js | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/structures/GuildChannel.js b/src/structures/GuildChannel.js index 9c06bbfc1c06..2797ab2b6292 100644 --- a/src/structures/GuildChannel.js +++ b/src/structures/GuildChannel.js @@ -511,16 +511,13 @@ class GuildChannel extends Channel { */ get manageable() { if (this.client.user.id === this.guild.ownerId) return true; - if (!this.viewable) { - return false; - } - if ( - VoiceBasedChannelTypes.includes(this.type) && - !this.permissionsFor(this.client.user).has(Permissions.FLAGS.CONNECT, false) - ) { + if (!this.viewable) return false; + const permissions = this.permissionsFor(this.client.user); + if (!permissions) return false; + if (VoiceBasedChannelTypes.includes(this.type) && !permissions.has(Permissions.FLAGS.CONNECT, false)) { return false; } - return this.permissionsFor(this.client.user).has(Permissions.FLAGS.MANAGE_CHANNELS, false); + return permissions.has(Permissions.FLAGS.MANAGE_CHANNELS, false); } /** From 3d899897317059b66dcf560b5566a339abdd0862 Mon Sep 17 00:00:00 2001 From: DraftProducts Date: Thu, 26 Aug 2021 01:21:02 +0200 Subject: [PATCH 4/5] =?UTF-8?q?refactor(GuildChannel):=20=E2=9A=A1?= =?UTF-8?q?=EF=B8=8F=20Refactor=20of=20manageable=20method?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Kyra --- src/structures/GuildChannel.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/structures/GuildChannel.js b/src/structures/GuildChannel.js index 2797ab2b6292..47057806e46a 100644 --- a/src/structures/GuildChannel.js +++ b/src/structures/GuildChannel.js @@ -511,13 +511,12 @@ class GuildChannel extends Channel { */ get manageable() { if (this.client.user.id === this.guild.ownerId) return true; - if (!this.viewable) return false; const permissions = this.permissionsFor(this.client.user); if (!permissions) return false; - if (VoiceBasedChannelTypes.includes(this.type) && !permissions.has(Permissions.FLAGS.CONNECT, false)) { - return false; - } - return permissions.has(Permissions.FLAGS.MANAGE_CHANNELS, false); + const bitfield = VoiceBasedChannelTypes.includes(this.type) + ? Permissions.FLAGS.VIEW_CHANNEL | Permissions.FLAGS.MANAGE_CHANNELS | Permissions.FLAGS.CONNECT + : Permissions.FLAGS.VIEW_CHANNEL | Permissions.FLAGS.MANAGE_CHANNELS; + return permissions.has(bitfield, false); } /** From 6989b59c88f9decfb0d62404b53281ca6b8e0d48 Mon Sep 17 00:00:00 2001 From: DraftMan Date: Thu, 26 Aug 2021 10:18:54 +0200 Subject: [PATCH 5/5] Update src/structures/GuildChannel.js Co-authored-by: ckohen --- src/structures/GuildChannel.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/structures/GuildChannel.js b/src/structures/GuildChannel.js index 47057806e46a..14f45b26dc78 100644 --- a/src/structures/GuildChannel.js +++ b/src/structures/GuildChannel.js @@ -514,7 +514,7 @@ class GuildChannel extends Channel { const permissions = this.permissionsFor(this.client.user); if (!permissions) return false; const bitfield = VoiceBasedChannelTypes.includes(this.type) - ? Permissions.FLAGS.VIEW_CHANNEL | Permissions.FLAGS.MANAGE_CHANNELS | Permissions.FLAGS.CONNECT + ? Permissions.FLAGS.MANAGE_CHANNELS | Permissions.FLAGS.CONNECT : Permissions.FLAGS.VIEW_CHANNEL | Permissions.FLAGS.MANAGE_CHANNELS; return permissions.has(bitfield, false); }