Prevent filtered posts from counting in Thread Watcher unread count regardless if they are quoting you.

This commit is contained in:
ccd0 2019-07-14 10:49:50 -07:00
parent a8264df928
commit ca11d70ef6
3 changed files with 8 additions and 11 deletions

View File

@ -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}

View File

@ -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)

View File

@ -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