From edc6c09500aacaf5603479164399ce188f7acf34 Mon Sep 17 00:00:00 2001 From: Krzysztof Kotlarek Date: Mon, 20 Jul 2020 09:52:06 +1000 Subject: [PATCH] FIX: correct stream counter when load more posts (#10264) Small bug in that fix in which we started loading posts in partial: https://github.com/discourse/discourse/pull/10240 We should add only displayed partial to stream counter to have a correct total number. --- app/assets/javascripts/discourse/app/models/post-stream.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/assets/javascripts/discourse/app/models/post-stream.js b/app/assets/javascripts/discourse/app/models/post-stream.js index 37b077c9500..c9b35f3dccb 100644 --- a/app/assets/javascripts/discourse/app/models/post-stream.js +++ b/app/assets/javascripts/discourse/app/models/post-stream.js @@ -300,13 +300,13 @@ export default RestModel.extend({ if (idx !== -1) { // Insert the gap at the appropriate place - stream.splice.apply(stream, [idx, 0].concat(gap)); let postIdx = currentPosts.indexOf(post); const origIdx = postIdx; let headGap = gap.slice(0, this.topic.chunk_size); let tailGap = gap.slice(this.topic.chunk_size); + stream.splice.apply(stream, [idx, 0].concat(headGap)); if (postIdx !== -1) { return this.findPostsByIds(headGap).then(posts => { posts.forEach(p => {