From c8f7eef912cd285955037467c51c80ca1bb99fb9 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Fri, 1 Nov 2013 15:59:33 +0100 Subject: [PATCH] Fix and tweak watcher updater after an index refresh. --- src/Miscellaneous/Index.coffee | 4 ++-- src/Monitoring/ThreadWatcher.coffee | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Miscellaneous/Index.coffee b/src/Miscellaneous/Index.coffee index 986feb182..f75754fcf 100644 --- a/src/Miscellaneous/Index.coffee +++ b/src/Miscellaneous/Index.coffee @@ -169,9 +169,9 @@ Index = if Conf['Index Mode'] is 'paged' pageNum = +window.location.pathname.split('/')[2] nodesPerPage = Index.threadsNumPerPage * 2 - nodes = Index.sortedNodes.slice nodesPerPage * pageNum, nodesPerPage * (pageNum + 1) + nodes = Index.sortedNodes.slice nodesPerPage * pageNum, nodesPerPage * (pageNum + 1) else - nodes = Index.sortedNodes + nodes = Index.sortedNodes $.event 'IndexRefresh' $.rmAll Index.root $.add Index.root, nodes diff --git a/src/Monitoring/ThreadWatcher.coffee b/src/Monitoring/ThreadWatcher.coffee index b33e96e71..76abbf521 100644 --- a/src/Monitoring/ThreadWatcher.coffee +++ b/src/Monitoring/ThreadWatcher.coffee @@ -74,14 +74,14 @@ ThreadWatcher = else if Conf['Auto Watch Reply'] ThreadWatcher.add board.threads[threadID] onIndexRefresh: -> - {db} = ThreadWatcher - for threadID, data of db.data.boards[g.BOARD.ID] when threadID not in g.BOARD.threads + {db} = ThreadWatcher + boardID = g.BOARD.ID + for threadID, data of db.data.boards[boardID] when not data.isDead and threadID not of g.BOARD.threads if Conf['Auto Prune'] - ThreadWatcher.rm g.BOARD.ID, threadID + ThreadWatcher.db.delete {boardID, threadID} else data.isDead = true - db.data.lastChecked = Date.now() - db.save() + ThreadWatcher.db.set {boardID, threadID, val: data} ThreadWatcher.refresh() onThreadRefresh: (e) -> {thread} = e.detail @@ -114,7 +114,7 @@ ThreadWatcher = ThreadWatcher.status.textContent = status return if @status isnt 404 if Conf['Auto Prune'] - ThreadWatcher.rm boardID, threadID + ThreadWatcher.db.delete {boardID, threadID} else data.isDead = true ThreadWatcher.db.set {boardID, threadID, val: data}