Fix hidden channels triggering the unread box
This commit is contained in:
parent
8692109bc5
commit
1676956f61
|
@ -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"',
|
find: '.displayName="ChannelListUnreadsStore"',
|
||||||
replacement: {
|
replacement: {
|
||||||
match: /(?<=if\(null==(\i))(?=.{0,160}?hasRelevantUnread\(\i\))/g, // Global because Discord has multiple methods like that in the same module
|
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})`
|
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
|
// Only render the channel header and buttons that work when transitioning to a hidden channel
|
||||||
{
|
{
|
||||||
find: "Missing channel in Channel.renderHeaderToolbar",
|
find: "Missing channel in Channel.renderHeaderToolbar",
|
||||||
|
|
Loading…
Reference in a new issue