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'
|
@db = new DataBoard 'hiddenThreads'
|
||||||
@syncCatalog()
|
@syncCatalog()
|
||||||
|
$.on d, 'IndexRefresh', @onrefresh
|
||||||
Thread.callbacks.push
|
Thread.callbacks.push
|
||||||
name: 'Thread Hiding'
|
name: 'Thread Hiding'
|
||||||
cb: @node
|
cb: @node
|
||||||
@ -14,6 +15,13 @@ ThreadHiding =
|
|||||||
return unless Conf['Thread Hiding']
|
return unless Conf['Thread Hiding']
|
||||||
$.prepend @OP.nodes.root, ThreadHiding.makeButton @, 'hide'
|
$.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: ->
|
syncCatalog: ->
|
||||||
# Sync hidden threads from the catalog into the index.
|
# Sync hidden threads from the catalog into the index.
|
||||||
hiddenThreads = ThreadHiding.db.get
|
hiddenThreads = ThreadHiding.db.get
|
||||||
|
|||||||
@ -99,11 +99,13 @@ Index =
|
|||||||
error: err
|
error: err
|
||||||
Main.handleErrors errors if errors
|
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 Thread, threads
|
||||||
Main.callbackNodes Post, posts
|
Main.callbackNodes Post, posts
|
||||||
|
$.event 'IndexRefresh'
|
||||||
|
|
||||||
Index.setIndex nodes
|
Index.setIndex nodes
|
||||||
$.event 'IndexRefresh'
|
|
||||||
setIndex: (nodes) ->
|
setIndex: (nodes) ->
|
||||||
$.rmAll Index.root
|
$.rmAll Index.root
|
||||||
$.add Index.root, Index.sort nodes
|
$.add Index.root, Index.sort nodes
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user