Resurrected posts do not belong in newPosts.

This commit is contained in:
ccd0 2015-03-13 18:58:19 -07:00
parent d1f281a5e5
commit 1c3d4b3d91
2 changed files with 5 additions and 4 deletions

View File

@ -7,14 +7,15 @@ MarkNewIPs =
node: ->
MarkNewIPs.ipCount = @ipCount
MarkNewIPs.postCount = @posts.keys.length
$.on d, 'ThreadUpdate', MarkNewIPs.onUpdate
onUpdate: (e) ->
{ipCount, newPosts, deletedPosts} = e.detail
{ipCount, postCount, newPosts, deletedPosts} = e.detail
return unless ipCount?
switch ipCount - MarkNewIPs.ipCount
when newPosts.length
when postCount - MarkNewIPs.postCount + deletedPosts.length
i = MarkNewIPs.ipCount
for fullID in newPosts
MarkNewIPs.markNew g.posts[fullID], ++i
@ -22,6 +23,7 @@ MarkNewIPs =
for fullID in newPosts
MarkNewIPs.markOld g.posts[fullID]
MarkNewIPs.ipCount = ipCount
MarkNewIPs.postCount = postCount
markNew: (post, ipCount) ->
suffix = if (ipCount // 10) % 10 is 1

View File

@ -293,13 +293,12 @@ ThreadUpdater =
# Insert new posts, not older ones.
continue if ID <= lastPost
newPosts.push "#{board}.#{ID}"
# XXX Resurrect wrongly deleted posts.
if (post = thread.posts[ID]) and not post.isFetchedQuote
post.resurrect()
continue
newPosts.push "#{board}.#{ID}"
node = Build.postFromObject postObject, board.ID
posts.push new Post node, thread, board
# Fetching your own posts after posting