diff --git a/source/browser/conversation-list.ts b/source/browser/conversation-list.ts index 778cb26a8..ecf67e1e4 100644 --- a/source/browser/conversation-list.ts +++ b/source/browser/conversation-list.ts @@ -191,8 +191,16 @@ function countUnread(mutationsList: MutationRecord[]): void { const alreadyChecked: any = []; // Look through the mutations for the one with the unread dot const unreadMutations = mutationsList.filter(mutation => - // When text is received + // When a conversations "becomes unread". ( + mutation.type === 'childList' + && mutation.addedNodes.length > 0 + && ((mutation.addedNodes[0] as Element).className === 'x1i10hfl x1qjc9v5 xjbqb8w xjqpnuy xa49m3k xqeqjp1 x2hbi6w x13fuv20 xu3j5b3 x1q0q8m5 x26u7qi x972fbf xcfux6l x1qhh985 xm0m39n x9f619 x1ypdohk xdl72j9 x2lah0s xe8uvvx xdj266r x11i5rnm xat24cr x1mh8g0r x2lwn1j xeuugli xexx8yu x4uap5 x18d9i69 xkhd6sd x1n2onr6 x16tdsg8 x1hl2dhg xggy1nq x1ja2u2z x1t137rt x1o1ewxj x3x9cwd x1e5q0jg x13rtm0m x1q0g3np x87ps6o x1lku1pv x78zum5 x1a2a7pz') + && ((mutation.addedNodes[0] as Element).parentElement?.className === 'x6s0dn4 x78zum5 xozqiw3') + && !((mutation.addedNodes[0] as Element).previousElementSibling?.className === 'x1fsd2vl') + ) + // When text is received + || ( mutation.type === 'characterData' // Make sure the text corresponds to a conversation && mutation.target.parentElement?.parentElement?.parentElement?.className === 'html-span xdj266r x11i5rnm xat24cr x1mh8g0r xexx8yu x18d9i69 xkhd6sd x1hl2dhg x16tdsg8 x1vvkbs x6s0dn4 x78zum5 x193iq5w xeuugli xg83lxy'