Skip to content

Commit

Permalink
Fix broken patches due to unread changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Nuckyz committed Nov 21, 2023
1 parent 9980c0d commit 6ab4cf0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
14 changes: 7 additions & 7 deletions src/plugins/showHiddenChannels/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export default definePlugin({
},
// Do not check for unreads when selecting the render level if the channel is hidden
{
match: /(?=!1===\i.\i\.hasRelevantUnread\(this\.record\))/,
match: /(?=!\(0,\i\.getHasImportantUnread\)\(this\.record\))/,
replace: "$self.isHiddenChannel(this.record)||"
},
// Make channels we dont have access to be the same level as normal ones
Expand Down Expand Up @@ -152,7 +152,7 @@ export default definePlugin({
}
},
{
find: ".UNREAD_HIGHLIGHT",
find: "UNREAD_IMPORTANT:",
predicate: () => settings.store.showMode === ShowMode.HiddenIconWithMutedStyle,
replacement: [
// Make the channel appear as muted if it's hidden
Expand All @@ -173,7 +173,7 @@ export default definePlugin({
]
},
{
find: ".UNREAD_HIGHLIGHT",
find: "UNREAD_IMPORTANT:",
replacement: [
{
// Make muted channels also appear as unread if hide unreads is false, using the HiddenIconWithMutedStyle and the channel is hidden
Expand All @@ -193,23 +193,23 @@ export default definePlugin({
// 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
match: /(?<=if\(null==(\i))(?=.{0,160}?getHasImportantUnread\)\(\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)\))/,
match: /(?=&&\(0,\i\.getHasImportantUnread\)\((\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)\))/,
match: /(?=&&\(0,\i\.getHasImportantUnread\)\((\i)\))/,
replace: "&&!$self.isHiddenChannel($1)"
}
},
Expand Down Expand Up @@ -255,7 +255,7 @@ export default definePlugin({
{
find: '"alt+shift+down"',
replacement: {
match: /(?<=getChannel\(\i\);return null!=(\i))(?=.{0,150}?hasRelevantUnread\(\i\))/,
match: /(?<=getChannel\(\i\);return null!=(\i))(?=.{0,150}?getHasImportantUnread\)\(\i\))/,
replace: (_, channel) => `&&!$self.isHiddenChannel(${channel})`
}
},
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/typingIndicator/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ export default definePlugin({

patches: [
{
find: ".UNREAD_HIGHLIGHT",
find: "UNREAD_IMPORTANT:",
replacement: {
match: /channel:(\i).{0,100}?channelEmoji,.{0,250}?\.children.{0,50}?:null/,
replace: "$&,$self.TypingIndicator($1.id)"
Expand Down

0 comments on commit 6ab4cf0

Please sign in to comment.