Fix thread hiding after an index refresh.
This commit is contained in:
parent
df62c78ed9
commit
66ebbd87f0
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user