Fix thread hiding after an index refresh.

This commit is contained in:
Mayhem 2013-10-31 00:21:12 +01:00
parent df62c78ed9
commit 66ebbd87f0
2 changed files with 11 additions and 1 deletions

View File

@ -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

View File

@ -99,11 +99,13 @@ Index =
error: err
Main.handleErrors errors if errors
# Add the threads and <hr>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