Fix update of thread watcher highlight on scroll.

Fixes bug from b9dea6f93165f8d3f277177cf222111373d89e20.

Also make quotesYou proper boolean.
This commit is contained in:
ccd0 2017-01-29 18:33:12 -08:00
parent 12fde7365e
commit 2aca3b1986
2 changed files with 5 additions and 4 deletions

View File

@ -238,7 +238,8 @@ ThreadWatcher =
threadID: threadID
defaultValue: 0
unread = quotingYou = 0
unread = 0
quotingYou = false
youOP = !!QuoteYou.db?.get {boardID, threadID, postID: threadID}
for postObj in @response.posts
@ -248,7 +249,7 @@ ThreadWatcher =
unread++
if !quotingYou and youOP and not Filter.isHidden(Build.parseJSON postObj, boardID)
quotingYou = 1
quotingYou = true
continue
continue unless !quotingYou and QuoteYou.db and postObj.com
@ -264,7 +265,7 @@ ThreadWatcher =
quotesYou = true
break
if quotesYou and not Filter.isHidden(Build.parseJSON postObj, boardID)
quotingYou++
quotingYou = true
if isDead isnt data.isDead or unread isnt data.unread or quotingYou isnt data.quotingYou
ThreadWatcher.db.extend {boardID, threadID, val: {isDead, unread, quotingYou}}

View File

@ -238,4 +238,4 @@ Unread =
ThreadWatcher.update Unread.thread.board.ID, Unread.thread.ID,
isDead: Unread.thread.isDead
unread: Unread.posts.size
quotingYou: Unread.postsQuotingYou.size
quotingYou: !!(if QuoteYou.isYou(Unread.thread.OP) then Unread.posts.size else Unread.postsQuotingYou.size)