reduce data sent in ThreadUpdate events

This commit is contained in:
ccd0 2014-06-18 00:14:09 -07:00
parent e810af22ca
commit 17ab7f5f36
3 changed files with 7 additions and 8 deletions

View File

@ -139,7 +139,7 @@ ThreadUpdater =
ThreadUpdater.thread.kill()
$.event 'ThreadUpdate',
404: true
thread: ThreadUpdater.thread
thread: {fullID: ThreadUpdater.thread.fullID}
else
ThreadUpdater.outdateCount++
ThreadUpdater.setInterval()
@ -269,12 +269,12 @@ ThreadUpdater =
unless ID in index
post.kill()
deletedPosts.push post
deletedPosts.push {fullID: post.fullID}
else if post.isDead
post.resurrect()
else if post.file and not (post.file.isDead or ID in files)
post.kill true
deletedFiles.push post
deletedFiles.push {fullID: post.fullID}
# Fetching your own posts after posting
if ThreadUpdater.postID and ThreadUpdater.postID is ID
@ -319,8 +319,8 @@ ThreadUpdater =
$.event 'ThreadUpdate',
404: false
thread: ThreadUpdater.thread
newPosts: posts
thread: {fullID: ThreadUpdater.thread}
newPosts: {fullID: post.fullID} for post in posts
deletedPosts: deletedPosts
deletedFiles: deletedFiles
postCount: OP.replies + 1

View File

@ -15,7 +15,6 @@ ThreadWatcher =
@list = @dialog.lastElementChild
$.on d, 'QRPostSuccessful', @cb.post
$.on d, 'ThreadUpdate', @cb.threadUpdate if g.VIEW is 'thread'
$.on sc, 'click', @toggleWatcher
$.on $('.move>.close', ThreadWatcher.dialog), 'click', @toggleWatcher
@ -105,7 +104,7 @@ ThreadWatcher =
ThreadWatcher.db.set {boardID, threadID, val: data}
ThreadWatcher.refresh()
onThreadRefresh: (e) ->
{thread} = e.detail
thread = g.threads[e.detail.thread.fullID]
return unless e.detail[404] and ThreadWatcher.db.get {boardID: thread.board.ID, threadID: thread.ID}
# Update 404 status.
ThreadWatcher.add thread

View File

@ -114,7 +114,7 @@ Unread =
if e.detail[404]
Unread.update()
else if !QuoteThreading.enabled
Unread.addPosts e.detail.newPosts
Unread.addPosts(g.posts[post.fullID] for post in e.detail.newPosts)
else
Unread.read()
Unread.update()