More quote threading compatible lastReadPost computation.
This commit is contained in:
parent
437f04729d
commit
a502db7f47
@ -120,11 +120,9 @@ Unread =
|
|||||||
{ID} = post
|
{ID} = post
|
||||||
{posts} = Unread
|
{posts} = Unread
|
||||||
return unless posts[ID]
|
return unless posts[ID]
|
||||||
if post is posts.first and !(Conf['Quote Threading'] and Unread.posts.length)
|
|
||||||
Unread.lastReadPost = ID
|
|
||||||
Unread.saveLastReadPost()
|
|
||||||
posts.rm ID
|
posts.rm ID
|
||||||
delete Unread.postsQuotingYou[ID]
|
delete Unread.postsQuotingYou[ID]
|
||||||
|
Unread.saveLastReadPost()
|
||||||
Unread.update()
|
Unread.update()
|
||||||
|
|
||||||
read: $.debounce 100, (e) ->
|
read: $.debounce 100, (e) ->
|
||||||
@ -132,11 +130,11 @@ Unread =
|
|||||||
height = doc.clientHeight
|
height = doc.clientHeight
|
||||||
|
|
||||||
{posts} = Unread
|
{posts} = Unread
|
||||||
maxID = 0
|
count = 0
|
||||||
while post = posts.first
|
while post = posts.first
|
||||||
break unless Header.getBottomOf(post.data.nodes.root) > -1 # post is not completely read
|
break unless Header.getBottomOf(post.data.nodes.root) > -1 # post is not completely read
|
||||||
{ID, data} = post
|
{ID, data} = post
|
||||||
maxID = Math.max maxID, ID
|
count++
|
||||||
posts.rm ID
|
posts.rm ID
|
||||||
delete Unread.postsQuotingYou[ID]
|
delete Unread.postsQuotingYou[ID]
|
||||||
|
|
||||||
@ -147,15 +145,16 @@ Unread =
|
|||||||
}
|
}
|
||||||
QuoteYou.lastRead = data.nodes.root
|
QuoteYou.lastRead = data.nodes.root
|
||||||
|
|
||||||
return unless maxID
|
return unless count
|
||||||
|
Unread.saveLastReadPost()
|
||||||
unless Conf['Quote Threading'] and posts.length
|
|
||||||
Unread.lastReadPost = maxID if Unread.lastReadPost < maxID or !Unread.lastReadPost
|
|
||||||
Unread.saveLastReadPost()
|
|
||||||
Unread.update() if e
|
Unread.update() if e
|
||||||
|
|
||||||
saveLastReadPost: $.debounce 2 * $.SECOND, ->
|
saveLastReadPost: $.debounce 2 * $.SECOND, ->
|
||||||
|
for ID in Unread.thread.posts.keys
|
||||||
|
break if Unread.posts[ID]
|
||||||
|
Unread.lastReadPost = +ID if +ID > Unread.lastReadPost
|
||||||
return if Unread.thread.isDead and !Unread.thread.isArchived
|
return if Unread.thread.isDead and !Unread.thread.isArchived
|
||||||
|
Unread.db.forceSync()
|
||||||
Unread.db.set
|
Unread.db.set
|
||||||
boardID: Unread.thread.board.ID
|
boardID: Unread.thread.board.ID
|
||||||
threadID: Unread.thread.ID
|
threadID: Unread.thread.ID
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user