Completely fix the 'read arbitrary post' use case.

This commit is contained in:
Nicolas Stepien 2013-04-03 00:34:24 +02:00
parent 2e1bb104e5
commit 1cad4b8d17

View File

@ -2609,10 +2609,10 @@ QuoteInline =
$.addClass post.nodes.root, 'forwarded'
post.forwarded++ or post.forwarded = 1
# Decrease the unread count if this post is in the array of unread posts.
if Unread.posts and (i = Unread.posts.indexOf post) isnt -1
Unread.posts.splice i, 1
Unread.update()
# Decrease the unread count if this post
# is in the array of unread posts.
return unless Unread.posts
Unread.readSinglePost post
rm: (quotelink, boardID, threadID, postID, context) ->
isBacklink = $.hasClass quotelink, 'backlink'
@ -3638,6 +3638,16 @@ Unread =
else
Unread.addPosts e.detail.newPosts
readSinglePost: (post) ->
return if (i = Unread.posts.indexOf post) is -1
Unread.posts.splice i, 1
if i is 0
Unread.lastReadPost = post.ID
Unread.saveLastReadPost()
if (i = Unread.postsQuotingYou.indexOf post) isnt -1
Unread.postsQuotingYou.splice i, 1
Unread.update()
readArray: (arr) ->
for post, i in arr
break if post.ID > Unread.lastReadPost