Reduce needless rebuilding of threads.
This commit is contained in:
parent
3b9a79647f
commit
e4a1f6d4a3
@ -615,7 +615,7 @@ Index =
|
|||||||
else
|
else
|
||||||
Index.parsedThreads[threadID].isHidden
|
Index.parsedThreads[threadID].isHidden
|
||||||
|
|
||||||
buildThreads: (threadIDs) ->
|
buildThreads: (threadIDs, isCatalog) ->
|
||||||
threads = []
|
threads = []
|
||||||
newThreads = []
|
newThreads = []
|
||||||
newPosts = []
|
newPosts = []
|
||||||
@ -624,20 +624,23 @@ Index =
|
|||||||
threadData = Index.liveThreadDict[ID]
|
threadData = Index.liveThreadDict[ID]
|
||||||
|
|
||||||
if (thread = g.BOARD.threads[ID])
|
if (thread = g.BOARD.threads[ID])
|
||||||
thread.setCount 'post', threadData.replies + 1, threadData.bumplimit
|
isStale = (thread.json isnt threadData) and (JSON.stringify(thread.json) isnt JSON.stringify(threadData))
|
||||||
thread.setCount 'file', threadData.images + !!threadData.ext, threadData.imagelimit
|
if isStale
|
||||||
thread.setStatus 'Sticky', !!threadData.sticky
|
thread.setCount 'post', threadData.replies + 1, threadData.bumplimit
|
||||||
thread.setStatus 'Closed', !!threadData.closed
|
thread.setCount 'file', threadData.images + !!threadData.ext, threadData.imagelimit
|
||||||
if thread.catalogView
|
thread.setStatus 'Sticky', !!threadData.sticky
|
||||||
|
thread.setStatus 'Closed', !!threadData.closed
|
||||||
|
if thread.catalogView and (isStale or !(isCatalog and Conf['Show Replies'] and Conf['Catalog Hover Expand']))
|
||||||
$.rm thread.catalogView.nodes.replies
|
$.rm thread.catalogView.nodes.replies
|
||||||
thread.catalogView.nodes.replies = null
|
thread.catalogView.nodes.replies = null
|
||||||
else
|
else
|
||||||
thread = new Thread ID, g.BOARD
|
thread = new Thread ID, g.BOARD
|
||||||
newThreads.push thread
|
newThreads.push thread
|
||||||
|
thread.json = threadData
|
||||||
threads.push thread
|
threads.push thread
|
||||||
|
|
||||||
if ((OP = thread.OP) and not OP.isFetchedQuote)
|
if ((OP = thread.OP) and not OP.isFetchedQuote)
|
||||||
OP.setCatalogOP false
|
OP.setCatalogOP isCatalog
|
||||||
thread.setPage(Index.threadPosition[ID] // Index.threadsNumPerPage + 1)
|
thread.setPage(Index.threadPosition[ID] // Index.threadsNumPerPage + 1)
|
||||||
else
|
else
|
||||||
obj = Index.parsedThreads[ID]
|
obj = Index.parsedThreads[ID]
|
||||||
@ -645,7 +648,7 @@ Index =
|
|||||||
OP.filterResults = obj.filterResults
|
OP.filterResults = obj.filterResults
|
||||||
newPosts.push OP
|
newPosts.push OP
|
||||||
|
|
||||||
Build.thread thread, threadData
|
Build.thread thread, threadData unless isCatalog
|
||||||
catch err
|
catch err
|
||||||
# Skip posts that we failed to parse.
|
# Skip posts that we failed to parse.
|
||||||
errors = [] unless errors
|
errors = [] unless errors
|
||||||
@ -790,7 +793,7 @@ Index =
|
|||||||
Index.sortedThreadIDs[offset ... offset + nodesPerPage]
|
Index.sortedThreadIDs[offset ... offset + nodesPerPage]
|
||||||
|
|
||||||
buildStructure: (threadIDs) ->
|
buildStructure: (threadIDs) ->
|
||||||
threads = Index.buildThreads threadIDs
|
threads = Index.buildThreads threadIDs, false
|
||||||
Index.buildReplies threads if Conf['Show Replies']
|
Index.buildReplies threads if Conf['Show Replies']
|
||||||
nodes = []
|
nodes = []
|
||||||
for thread in threads
|
for thread in threads
|
||||||
@ -818,7 +821,7 @@ Index =
|
|||||||
return
|
return
|
||||||
|
|
||||||
buildCatalogPart: (threadIDs) ->
|
buildCatalogPart: (threadIDs) ->
|
||||||
threads = Index.buildThreads threadIDs
|
threads = Index.buildThreads threadIDs, true
|
||||||
Index.buildCatalogViews threads
|
Index.buildCatalogViews threads
|
||||||
Index.sizeCatalogViews threads
|
Index.sizeCatalogViews threads
|
||||||
Index.buildCatalogReplies threads if Conf['Show Replies'] and Conf['Catalog Hover Expand']
|
Index.buildCatalogReplies threads if Conf['Show Replies'] and Conf['Catalog Hover Expand']
|
||||||
|
|||||||
@ -12,6 +12,7 @@ class Thread
|
|||||||
@postLimit = false
|
@postLimit = false
|
||||||
@fileLimit = false
|
@fileLimit = false
|
||||||
@ipCount = undefined
|
@ipCount = undefined
|
||||||
|
@json = null
|
||||||
|
|
||||||
@OP = null
|
@OP = null
|
||||||
@catalogView = null
|
@catalogView = null
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user