Take into account dead threads in the watcher after an index refresh.

This commit is contained in:
Mayhem 2013-10-31 04:32:45 +01:00
parent 79644546ce
commit 22c561b796
2 changed files with 12 additions and 0 deletions

View File

@ -13,6 +13,7 @@ ThreadWatcher =
$.on d, '4chanXInitFinished', @ready
switch g.VIEW
when 'index'
$.on d, 'IndexRefresh', @cb.indexUpdate
$.on d, 'IndexRefresh', @refresh
when 'thread'
$.on d, 'ThreadUpdate', @cb.threadUpdate
@ -73,6 +74,16 @@ ThreadWatcher =
$.set 'AutoWatch', threadID
else if Conf['Auto Watch Reply']
ThreadWatcher.add board.threads[threadID]
indexUpdate: ->
{db} = ThreadWatcher
for threadID, data of db.data.boards[g.BOARD.ID] when threadID not in g.BOARD.threads
if Conf['Auto Prune']
ThreadWatcher.rm g.BOARD.ID, threadID
else
data.isDead = true
db.data.lastChecked = Date.now()
db.save()
ThreadWatcher.refresh()
threadUpdate: (e) ->
{thread} = e.detail
return unless e.detail[404] and ThreadWatcher.db.get {boardID: thread.board.ID, threadID: thread.ID}

View File

@ -801,6 +801,7 @@ QR =
e.preventDefault()
generatePostableThreadsList: ->
return unless QR.nodes
list = QR.nodes.thread
options = [list.firstChild]
for thread of g.BOARD.threads