diff --git a/src/General/Index.coffee b/src/General/Index.coffee index 4b50024a4..ca87b017f 100644 --- a/src/General/Index.coffee +++ b/src/General/Index.coffee @@ -614,6 +614,8 @@ Index = Build.spoilerRange[g.BOARD.ID] = Index.liveThreadData[0].custom_spoiler g.BOARD.threads.forEach (thread) -> (thread.collect() unless thread.ID in Index.liveThreadIDs) + $.event 'IndexUpdate', + threads: ("#{g.BOARD}.#{ID}" for ID in Index.liveThreadIDs) return isHidden: (threadID) -> diff --git a/src/Monitoring/ThreadWatcher.coffee b/src/Monitoring/ThreadWatcher.coffee index 1b295c439..b6f2abedc 100644 --- a/src/Monitoring/ThreadWatcher.coffee +++ b/src/Monitoring/ThreadWatcher.coffee @@ -28,7 +28,7 @@ ThreadWatcher = switch g.VIEW when 'index' - $.on d, 'IndexRefreshInternal', @cb.onIndexRefresh + $.on d, 'IndexUpdate', @cb.onIndexUpdate when 'thread' $.on d, 'ThreadUpdate', @cb.onThreadRefresh @@ -139,11 +139,11 @@ ThreadWatcher = ThreadWatcher.addRaw boardID, threadID, {} else if Conf['Auto Watch Reply'] ThreadWatcher.add g.threads[boardID + '.' + threadID] - onIndexRefresh: -> + onIndexUpdate: (e) -> {db} = ThreadWatcher boardID = g.BOARD.ID nKilled = 0 - for threadID, data of db.data.boards[boardID] when not data?.isDead and threadID not of g.BOARD.threads + for threadID, data of db.data.boards[boardID] when not data?.isDead and "#{boardID}.#{threadID}" not in e.detail.threads nKilled++ if Conf['Auto Prune'] or not (data and typeof data is 'object') # corrupt data db.delete {boardID, threadID}