Apply filters to first unread post in watched thread and to first post quoting you.

This commit is contained in:
ccd0 2019-07-16 23:32:06 -07:00
parent dce04bf3df
commit 1bad329294

View File

@ -355,25 +355,29 @@ ThreadWatcher =
for postObj in @response.posts for postObj in @response.posts
continue unless postObj.no > (data.last or 0) and 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 QuoteYou.db?.get {siteID, boardID, threadID, postID: postObj.no}
continue if Filter.isHidden(site.Build.parseJSON postObj, {siteID, boardID})
unread++
quotingYou = postObj.no if !Conf['Require OP Quote Link'] and youOP
continue unless QuoteYou.db and postObj.com
quotesYou = false
if !Conf['Require OP Quote Link'] and youOP
quotesYou = true
else if QuoteYou.db and postObj.com
regexp = site.regexp.quotelinkHTML regexp = site.regexp.quotelinkHTML
regexp.lastIndex = 0 regexp.lastIndex = 0
while match = regexp.exec postObj.com while (match = regexp.exec postObj.com)
if QuoteYou.db.get { if QuoteYou.db.get {
siteID siteID
boardID: if match[1] then encodeURIComponent(match[1]) else boardID boardID: if match[1] then encodeURIComponent(match[1]) else boardID
threadID: match[2] or threadID threadID: match[2] or threadID
postID: match[3] or match[2] or threadID postID: match[3] or match[2] or threadID
} }
quotingYou = postObj.no quotesYou = true
break break
if !unread or (!quotingYou and quotesYou)
continue if Filter.isHidden(site.Build.parseJSON postObj, {siteID, boardID})
unread++
quotingYou = postObj.no if quotesYou
newData or= {} newData or= {}
$.extend newData, {last, replies, isDead, unread, quotingYou} $.extend newData, {last, replies, isDead, unread, quotingYou}
ThreadWatcher.update siteID, boardID, threadID, newData ThreadWatcher.update siteID, boardID, threadID, newData