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