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() ThreadUpdater.thread.kill()
$.event 'ThreadUpdate', $.event 'ThreadUpdate',
404: true 404: true
thread: ThreadUpdater.thread thread: {fullID: ThreadUpdater.thread.fullID}
else else
ThreadUpdater.outdateCount++ ThreadUpdater.outdateCount++
ThreadUpdater.setInterval() ThreadUpdater.setInterval()
@ -269,12 +269,12 @@ ThreadUpdater =
unless ID in index unless ID in index
post.kill() post.kill()
deletedPosts.push post deletedPosts.push {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 post deletedFiles.push {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
@ -319,8 +319,8 @@ ThreadUpdater =
$.event 'ThreadUpdate', $.event 'ThreadUpdate',
404: false 404: false
thread: ThreadUpdater.thread thread: {fullID: ThreadUpdater.thread}
newPosts: posts newPosts: {fullID: post.fullID} for post in posts
deletedPosts: deletedPosts deletedPosts: deletedPosts
deletedFiles: deletedFiles deletedFiles: deletedFiles
postCount: OP.replies + 1 postCount: OP.replies + 1

View File

@ -15,7 +15,6 @@ ThreadWatcher =
@list = @dialog.lastElementChild @list = @dialog.lastElementChild
$.on d, 'QRPostSuccessful', @cb.post $.on d, 'QRPostSuccessful', @cb.post
$.on d, 'ThreadUpdate', @cb.threadUpdate if g.VIEW is 'thread'
$.on sc, 'click', @toggleWatcher $.on sc, 'click', @toggleWatcher
$.on $('.move>.close', ThreadWatcher.dialog), 'click', @toggleWatcher $.on $('.move>.close', ThreadWatcher.dialog), 'click', @toggleWatcher
@ -105,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} = 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} 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

View File

@ -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 e.detail.newPosts Unread.addPosts(g.posts[post.fullID] for post in e.detail.newPosts)
else else
Unread.read() Unread.read()
Unread.update() Unread.update()