From 1676956f6113b74490d974e81a2f78f22f496cc9 Mon Sep 17 00:00:00 2001 From: Nuckyz <61953774+Nuckyz@users.noreply.github.com> Date: Thu, 26 Oct 2023 20:59:48 -0300 Subject: [PATCH] Fix hidden channels triggering the unread box --- src/plugins/showHiddenChannels/index.tsx | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/plugins/showHiddenChannels/index.tsx b/src/plugins/showHiddenChannels/index.tsx index 9a7f1e63..4d828acd 100644 --- a/src/plugins/showHiddenChannels/index.tsx +++ b/src/plugins/showHiddenChannels/index.tsx @@ -195,13 +195,29 @@ export default definePlugin({ ] }, { - // Hide New unreads box for hidden channels + // Hide the new version of unreads box for hidden channels find: '.displayName="ChannelListUnreadsStore"', replacement: { match: /(?<=if\(null==(\i))(?=.{0,160}?hasRelevantUnread\(\i\))/g, // Global because Discord has multiple methods like that in the same module replace: (_, channel) => `||$self.isHiddenChannel(${channel})` } }, + { + // Make the old version of unreads box not visible for hidden channels + find: "renderBottomUnread(){", + replacement: { + match: /(?=&&\i\.\i\.hasRelevantUnread\((\i\.record)\))/, + replace: "&&!$self.isHiddenChannel($1)" + } + }, + { + // Make the state of the old version of unreads box not include hidden channels + find: ".useFlattenedChannelIdListWithThreads)", + replacement: { + match: /(?=&&\i\.\i\.hasRelevantUnread\((\i)\))/, + replace: "&&!$self.isHiddenChannel($1)" + } + }, // Only render the channel header and buttons that work when transitioning to a hidden channel { find: "Missing channel in Channel.renderHeaderToolbar",