Skip to content

Commit

Permalink
Fix hidden channels triggering the unread box
Browse files Browse the repository at this point in the history
  • Loading branch information
Nuckyz committed Oct 26, 2023
1 parent 8692109 commit 1676956
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/plugins/showHiddenChannels/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 1676956

Please sign in to comment.