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