Fix catalog crashing on hidden/filtered threads.

This commit is contained in:
ccd0 2016-09-21 05:25:06 -07:00
parent fca9f97510
commit 9891f03bca

View File

@ -630,8 +630,7 @@ Index =
Main.handleErrors errors if errors Main.handleErrors errors if errors
Main.callbackNodes 'Post', posts Main.callbackNodes 'Post', posts
buildCatalogViews: -> buildCatalogViews: (threads) ->
threads = Index.sortedThreads.filter (thread) -> !thread.isHidden isnt Index.showHiddenThreads
catalogThreads = [] catalogThreads = []
for thread in threads when !thread.catalogView for thread in threads when !thread.catalogView
catalogThreads.push new CatalogThread Build.catalogThread(thread), thread catalogThreads.push new CatalogThread Build.catalogThread(thread), thread
@ -692,15 +691,17 @@ Index =
buildIndex: -> buildIndex: ->
return unless Index.liveThreadData return unless Index.liveThreadData
switch Conf['Index Mode'] switch Conf['Index Mode']
when 'all pages', 'catalog' when 'all pages'
threads = Index.sortedThreads threads = Index.sortedThreads
when 'catalog'
threads = Index.sortedThreads.filter (thread) -> !thread.isHidden isnt Index.showHiddenThreads
else else
threads = Index.threadsOnPage Index.currentPage threads = Index.threadsOnPage Index.currentPage
delete Index.pageNum delete Index.pageNum
$.rmAll Index.root $.rmAll Index.root
$.rmAll Header.hover $.rmAll Header.hover
if Conf['Index Mode'] is 'catalog' if Conf['Index Mode'] is 'catalog'
nodes = Index.buildCatalogViews() nodes = Index.buildCatalogViews threads
Index.sizeCatalogViews nodes Index.sizeCatalogViews nodes
Index.moveComments threads Index.moveComments threads
if Conf['Index Mode'] is 'catalog' if Conf['Index Mode'] is 'catalog'