From ca11d70ef6338d31d5e2e9b4a841e2a7d3f1deb8 Mon Sep 17 00:00:00 2001 From: ccd0 Date: Sun, 14 Jul 2019 10:49:50 -0700 Subject: [PATCH] Prevent filtered posts from counting in Thread Watcher unread count regardless if they are quoting you. --- src/Monitoring/ThreadWatcher.coffee | 17 ++++++----------- src/Monitoring/Unread.coffee | 1 + src/Monitoring/UnreadIndex.coffee | 1 + 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/src/Monitoring/ThreadWatcher.coffee b/src/Monitoring/ThreadWatcher.coffee index c6c2cc7c3..4e5f05bb2 100644 --- a/src/Monitoring/ThreadWatcher.coffee +++ b/src/Monitoring/ThreadWatcher.coffee @@ -339,23 +339,20 @@ ThreadWatcher = return if last is data.last and isDead is data.isDead lastReadPost = ThreadWatcher.unreaddb.get {siteID, boardID, threadID, defaultValue: 0} - unread = 0 - quotingYou = false + unread = data.unread or 0 + quotingYou = data.quotingYou or false youOP = !!QuoteYou.db?.get {siteID, boardID, threadID, postID: threadID} for postObj in @response.posts - continue unless postObj.no > lastReadPost + continue unless postObj.no > (data.last or 0) and postObj.no > lastReadPost continue if QuoteYou.db?.get {siteID, boardID, threadID, postID: postObj.no} + continue if Filter.isHidden(site.Build.parseJSON postObj, boardID, siteID) unread++ - - if !quotingYou and !Conf['Require OP Quote Link'] and youOP and not Filter.isHidden(site.Build.parseJSON postObj, boardID, siteID) - quotingYou = true - continue + quotingYou = true if !Conf['Require OP Quote Link'] and youOP continue unless !quotingYou and QuoteYou.db and postObj.com - quotesYou = false regexp = site.regexp.quotelinkHTML regexp.lastIndex = 0 while match = regexp.exec postObj.com @@ -365,10 +362,8 @@ ThreadWatcher = threadID: match[2] or threadID postID: match[3] or match[2] or threadID } - quotesYou = true + quotingYou = true break - if quotesYou and not Filter.isHidden(site.Build.parseJSON postObj, boardID, siteID) - quotingYou = true newData or= {} $.extend newData, {last, replies, isDead, unread, quotingYou} diff --git a/src/Monitoring/Unread.coffee b/src/Monitoring/Unread.coffee index a80a75692..a79309c93 100644 --- a/src/Monitoring/Unread.coffee +++ b/src/Monitoring/Unread.coffee @@ -271,6 +271,7 @@ Unread = $.forceSync 'Remember Last Read Post' if Conf['Remember Last Read Post'] and (!Unread.thread.isDead or Unread.thread.isArchived) ThreadWatcher.update g.SITE.ID, Unread.thread.board.ID, Unread.thread.ID, + last: Unread.thread.lastPost isDead: Unread.thread.isDead unread: Unread.posts.size quotingYou: !!(if !Conf['Require OP Quote Link'] and QuoteYou.isYou(Unread.thread.OP) then Unread.posts.size else Unread.postsQuotingYou.size) diff --git a/src/Monitoring/UnreadIndex.coffee b/src/Monitoring/UnreadIndex.coffee index f7d8afc04..c16fc316d 100644 --- a/src/Monitoring/UnreadIndex.coffee +++ b/src/Monitoring/UnreadIndex.coffee @@ -102,5 +102,6 @@ UnreadIndex = $.rm UnreadIndex.hr[thread.fullID] thread.nodes.root.classList.remove 'unread-thread' ThreadWatcher.update g.SITE.ID, thread.board.ID, thread.ID, + last: thread.lastPost unread: 0 quotingYou: false