Fix bug in reply count shown on thread stubs.
This commit is contained in:
parent
773689306a
commit
8d727ed555
@ -178,7 +178,7 @@ Build =
|
||||
textContent: Build.summaryText '', posts, files
|
||||
href: "/#{boardID}/thread/#{threadID}"
|
||||
|
||||
thread: (thread, data) ->
|
||||
thread: (thread, data, withReplies) ->
|
||||
if (root = thread.nodes.root)
|
||||
$.rmAll root
|
||||
else
|
||||
@ -187,8 +187,8 @@ Build =
|
||||
id: "t#{data.no}"
|
||||
$.add root, Build.hat.cloneNode(false) if Build.hat
|
||||
$.add root, thread.OP.nodes.root
|
||||
if data.omitted_posts or !Conf['Show Replies'] and data.replies
|
||||
[posts, files] = if Conf['Show Replies']
|
||||
if data.omitted_posts or !withReplies and data.replies
|
||||
[posts, files] = if withReplies
|
||||
# XXX data.omitted_images is not accurate.
|
||||
[data.omitted_posts, data.images - data.last_replies.filter((data) -> !!data.ext).length]
|
||||
else
|
||||
|
||||
@ -691,7 +691,7 @@ Index =
|
||||
isHiddenReply: (threadID, replyData) ->
|
||||
PostHiding.isHidden(g.BOARD.ID, threadID, replyData.no) or Filter.isHidden(Build.parseJSON replyData, g.BOARD.ID)
|
||||
|
||||
buildThreads: (threadIDs, isCatalog) ->
|
||||
buildThreads: (threadIDs, isCatalog, withReplies) ->
|
||||
threads = []
|
||||
newThreads = []
|
||||
newPosts = []
|
||||
@ -724,7 +724,8 @@ Index =
|
||||
OP.filterResults = obj.filterResults
|
||||
newPosts.push OP
|
||||
|
||||
Build.thread thread, threadData unless isCatalog and thread.nodes.root
|
||||
unless isCatalog and thread.nodes.root
|
||||
Build.thread thread, threadData, withReplies
|
||||
catch err
|
||||
# Skip posts that we failed to parse.
|
||||
errors = [] unless errors
|
||||
@ -733,6 +734,9 @@ Index =
|
||||
error: err
|
||||
Main.handleErrors errors if errors
|
||||
|
||||
if withReplies
|
||||
newPosts = newPosts.concat(Index.buildReplies threads)
|
||||
|
||||
Main.callbackNodes 'Thread', newThreads
|
||||
Main.callbackNodes 'Post', newPosts
|
||||
Index.updateHideLabel()
|
||||
@ -761,7 +765,7 @@ Index =
|
||||
$.add thread.nodes.root, nodes
|
||||
|
||||
Main.handleErrors errors if errors
|
||||
Main.callbackNodes 'Post', posts
|
||||
posts
|
||||
|
||||
buildCatalogViews: (threads) ->
|
||||
catalogThreads = []
|
||||
@ -873,8 +877,7 @@ Index =
|
||||
Index.sortedThreadIDs[offset ... offset + nodesPerPage]
|
||||
|
||||
buildStructure: (threadIDs) ->
|
||||
threads = Index.buildThreads threadIDs, false
|
||||
Index.buildReplies threads if Conf['Show Replies']
|
||||
threads = Index.buildThreads threadIDs, false, Conf['Show Replies']
|
||||
nodes = []
|
||||
for thread in threads
|
||||
nodes.push thread.nodes.root, $.el('hr')
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user