Make MarkNewIPs use deletedPosts.
This commit is contained in:
parent
39e33ddccf
commit
acf31945b1
@ -7,29 +7,21 @@ MarkNewIPs =
|
|||||||
|
|
||||||
node: ->
|
node: ->
|
||||||
MarkNewIPs.ipCount = @ipCount
|
MarkNewIPs.ipCount = @ipCount
|
||||||
MarkNewIPs.postIDs = (+x for x in @posts.keys)
|
|
||||||
$.on d, 'ThreadUpdate', MarkNewIPs.onUpdate
|
$.on d, 'ThreadUpdate', MarkNewIPs.onUpdate
|
||||||
|
|
||||||
onUpdate: (e) ->
|
onUpdate: (e) ->
|
||||||
{ipCount, newPosts} = e.detail
|
{ipCount, newPosts, deletedPosts} = e.detail
|
||||||
{postIDs} = ThreadUpdater
|
|
||||||
return unless ipCount?
|
return unless ipCount?
|
||||||
if newPosts.length
|
|
||||||
obj = {}
|
switch ipCount - MarkNewIPs.ipCount
|
||||||
obj[x] = true for x in MarkNewIPs.postIDs
|
when newPosts.length
|
||||||
added = 0
|
i = MarkNewIPs.ipCount
|
||||||
added++ for x in postIDs when not (x of obj)
|
for fullID in newPosts
|
||||||
removed = MarkNewIPs.postIDs.length + added - postIDs.length
|
MarkNewIPs.markNew g.posts[fullID], ++i
|
||||||
switch ipCount - MarkNewIPs.ipCount
|
when -deletedPosts.length
|
||||||
when added
|
for fullID in newPosts
|
||||||
i = MarkNewIPs.ipCount
|
MarkNewIPs.markOld g.posts[fullID]
|
||||||
for fullID in newPosts
|
|
||||||
MarkNewIPs.markNew g.posts[fullID], ++i
|
|
||||||
when -removed
|
|
||||||
for fullID in newPosts
|
|
||||||
MarkNewIPs.markOld g.posts[fullID]
|
|
||||||
MarkNewIPs.ipCount = ipCount
|
MarkNewIPs.ipCount = ipCount
|
||||||
MarkNewIPs.postIDs = postIDs
|
|
||||||
|
|
||||||
markNew: (post, ipCount) ->
|
markNew: (post, ipCount) ->
|
||||||
suffix = if (ipCount // 10) % 10 is 1
|
suffix = if (ipCount // 10) % 10 is 1
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user