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.
This commit is contained in:
Krzysztof Kotlarek 2020-07-20 09:52:06 +10:00 committed by GitHub
parent de79f19947
commit edc6c09500
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -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 => {