follow Mayhem's changes to ThreadUpdate API
This commit is contained in:
parent
317beff1ed
commit
63a9d3dcd1
@ -138,7 +138,6 @@ ThreadUpdater =
|
|||||||
ThreadUpdater.thread.kill()
|
ThreadUpdater.thread.kill()
|
||||||
$.event 'ThreadUpdate',
|
$.event 'ThreadUpdate',
|
||||||
404: true
|
404: true
|
||||||
thread: {fullID: ThreadUpdater.thread.fullID}
|
|
||||||
else
|
else
|
||||||
ThreadUpdater.outdateCount++
|
ThreadUpdater.outdateCount++
|
||||||
ThreadUpdater.setInterval()
|
ThreadUpdater.setInterval()
|
||||||
@ -256,9 +255,6 @@ ThreadUpdater =
|
|||||||
node = Build.postFromObject postObject, ThreadUpdater.thread.board.ID
|
node = Build.postFromObject postObject, ThreadUpdater.thread.board.ID
|
||||||
posts.push new Post node, ThreadUpdater.thread, ThreadUpdater.thread.board
|
posts.push new Post node, ThreadUpdater.thread, ThreadUpdater.thread.board
|
||||||
|
|
||||||
deletedPosts = []
|
|
||||||
deletedFiles = []
|
|
||||||
|
|
||||||
# Check for deleted posts/files.
|
# Check for deleted posts/files.
|
||||||
ThreadUpdater.thread.posts.forEach (post) ->
|
ThreadUpdater.thread.posts.forEach (post) ->
|
||||||
# XXX tmp fix for 4chan's racing condition
|
# XXX tmp fix for 4chan's racing condition
|
||||||
@ -268,12 +264,10 @@ ThreadUpdater =
|
|||||||
|
|
||||||
unless ID in index
|
unless ID in index
|
||||||
post.kill()
|
post.kill()
|
||||||
deletedPosts.push {ID: post.ID, fullID: post.fullID}
|
|
||||||
else if post.isDead
|
else if post.isDead
|
||||||
post.resurrect()
|
post.resurrect()
|
||||||
else if post.file and not (post.file.isDead or ID in files)
|
else if post.file and not (post.file.isDead or ID in files)
|
||||||
post.kill true
|
post.kill true
|
||||||
deletedFiles.push {ID: post.ID, fullID: post.fullID}
|
|
||||||
|
|
||||||
# Fetching your own posts after posting
|
# Fetching your own posts after posting
|
||||||
if ThreadUpdater.postID and ThreadUpdater.postID is ID
|
if ThreadUpdater.postID and ThreadUpdater.postID is ID
|
||||||
@ -318,9 +312,7 @@ ThreadUpdater =
|
|||||||
|
|
||||||
$.event 'ThreadUpdate',
|
$.event 'ThreadUpdate',
|
||||||
404: false
|
404: false
|
||||||
thread: {ID: ThreadUpdater.thread.ID, fullID: ThreadUpdater.thread.fullID}
|
threadID: ThreadUpdater.thread.fullID
|
||||||
newPosts: {ID: post.ID, fullID: post.fullID} for post in posts
|
newPosts: posts.map (post) -> post.fullID
|
||||||
deletedPosts: deletedPosts
|
|
||||||
deletedFiles: deletedFiles
|
|
||||||
postCount: OP.replies + 1
|
postCount: OP.replies + 1
|
||||||
fileCount: OP.images + (!!ThreadUpdater.thread.OP.file and !ThreadUpdater.thread.OP.file.isDead)
|
fileCount: OP.images + (!!ThreadUpdater.thread.OP.file and !ThreadUpdater.thread.OP.file.isDead)
|
||||||
|
|||||||
@ -104,7 +104,7 @@ ThreadWatcher =
|
|||||||
ThreadWatcher.db.set {boardID, threadID, val: data}
|
ThreadWatcher.db.set {boardID, threadID, val: data}
|
||||||
ThreadWatcher.refresh()
|
ThreadWatcher.refresh()
|
||||||
onThreadRefresh: (e) ->
|
onThreadRefresh: (e) ->
|
||||||
thread = g.threads[e.detail.thread.fullID]
|
thread = g.threads[e.detail.threadID]
|
||||||
return unless e.detail[404] and ThreadWatcher.db.get {boardID: thread.board.ID, threadID: thread.ID}
|
return unless e.detail[404] and ThreadWatcher.db.get {boardID: thread.board.ID, threadID: thread.ID}
|
||||||
# Update 404 status.
|
# Update 404 status.
|
||||||
ThreadWatcher.add thread
|
ThreadWatcher.add thread
|
||||||
|
|||||||
@ -114,7 +114,7 @@ Unread =
|
|||||||
if e.detail[404]
|
if e.detail[404]
|
||||||
Unread.update()
|
Unread.update()
|
||||||
else if !QuoteThreading.enabled
|
else if !QuoteThreading.enabled
|
||||||
Unread.addPosts(g.posts[post.fullID] for post in e.detail.newPosts)
|
Unread.addPosts e.detail.newPosts.map (fullID) -> g.posts[fullID]
|
||||||
else
|
else
|
||||||
Unread.read()
|
Unread.read()
|
||||||
Unread.update()
|
Unread.update()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user