From 66ebbd87f07cf77caf88a35a77b6b77b910af404 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Thu, 31 Oct 2013 00:21:12 +0100 Subject: [PATCH] Fix thread hiding after an index refresh. --- src/Filtering/ThreadHiding.coffee | 8 ++++++++ src/Miscellaneous/Index.coffee | 4 +++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/Filtering/ThreadHiding.coffee b/src/Filtering/ThreadHiding.coffee index 21bd4c211..34f9a54f2 100644 --- a/src/Filtering/ThreadHiding.coffee +++ b/src/Filtering/ThreadHiding.coffee @@ -4,6 +4,7 @@ ThreadHiding = @db = new DataBoard 'hiddenThreads' @syncCatalog() + $.on d, 'IndexRefresh', @onrefresh Thread.callbacks.push name: 'Thread Hiding' cb: @node @@ -14,6 +15,13 @@ ThreadHiding = return unless Conf['Thread Hiding'] $.prepend @OP.nodes.root, ThreadHiding.makeButton @, 'hide' + onrefresh: -> + for threadID, thread of g.BOARD.threads when thread.isHidden + hasStub = !!thread.stub + ThreadHiding.show thread + ThreadHiding.hide thread, hasStub + return + syncCatalog: -> # Sync hidden threads from the catalog into the index. hiddenThreads = ThreadHiding.db.get diff --git a/src/Miscellaneous/Index.coffee b/src/Miscellaneous/Index.coffee index 44db465b6..8045030c8 100644 --- a/src/Miscellaneous/Index.coffee +++ b/src/Miscellaneous/Index.coffee @@ -99,11 +99,13 @@ Index = error: err Main.handleErrors errors if errors + # Add the threads and
s in a container to make sure all features work. + $.nodes nodes Main.callbackNodes Thread, threads Main.callbackNodes Post, posts + $.event 'IndexRefresh' Index.setIndex nodes - $.event 'IndexRefresh' setIndex: (nodes) -> $.rmAll Index.root $.add Index.root, Index.sort nodes