aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSnek <107999380+sneksnake@users.noreply.github.com>2022-10-27 18:37:54 +0200
committerGitHub <noreply@github.com>2022-10-27 18:37:54 +0200
commitc76e9f5e3d5a282a0e723593fcdc4cf996d419be (patch)
tree69643a84e5da8a3516f4bd299b86b842638a63a1
parentce73a5f172aabbf2a6b8f66cac48a23a4ea0f495 (diff)
downloadVencord-c76e9f5e3d5a282a0e723593fcdc4cf996d419be.tar.gz
Vencord-c76e9f5e3d5a282a0e723593fcdc4cf996d419be.tar.bz2
Vencord-c76e9f5e3d5a282a0e723593fcdc4cf996d419be.zip
better patch & visual bug fix (#167)
-rw-r--r--src/plugins/showHiddenChannels.tsx20
1 files changed, 5 insertions, 15 deletions
diff --git a/src/plugins/showHiddenChannels.tsx b/src/plugins/showHiddenChannels.tsx
index 0650cc4..84f7c3e 100644
--- a/src/plugins/showHiddenChannels.tsx
+++ b/src/plugins/showHiddenChannels.tsx
@@ -70,19 +70,11 @@ export default definePlugin({
}
},
{
- // Prevents Discord from trying to fetch message and create a 403 error
- find: "fetchMessages:function",
+ // inside the onMouseClick handler, we check if the channel is hidden and open the modal if it is
+ find: ".handleThreadsPopoutClose();",
replacement: {
- match: /fetchMessages:function\((\w)\){/g,
- replace: "fetchMessages:function($1){if(Vencord.Plugins.plugins.ShowHiddenChannels.isHiddenChannel($1)) return;"
- }
- },
- {
- // Don't switch to the channel if it's hidden, but show a modal instead
- find: ".selectGuild(",
- replacement: {
- match: /(function \w+\(\w\)\{var (\w)=\w+\(\w\);)/g,
- replace: "$1if(Vencord.Plugins.plugins.ShowHiddenChannels.channelSelected($2?.params))return;"
+ match: /((\w)\.handleThreadsPopoutClose\(\);)/g,
+ replace: "if(Vencord.Plugins.plugins.ShowHiddenChannels.channelSelected($2?.props?.channel))return;$1"
}
},
{
@@ -121,9 +113,7 @@ export default definePlugin({
channel._isHiddenChannel = !can(VIEW_CHANNEL, channel) || (channel.type === 2 && !can(CONNECT, channel));
return channel._isHiddenChannel;
},
- channelSelected(channelData) {
- if (!channelData) return false;
- const channel = ChannelStore.getChannel(channelData.channelId);
+ channelSelected(channel) {
if (!channel) return false;
const isHidden = this.isHiddenChannel(channel);
// check for type again, otherwise it would show it for hidden stage channels