From 60bf564321013b7ff6e93f4027fc9ff16701d7d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Mon, 23 Aug 2021 12:31:11 -0400 Subject: [PATCH] fix: #9729, insert new posts after topic events --- public/src/client/topic/posts.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/public/src/client/topic/posts.js b/public/src/client/topic/posts.js index 89d3956a4e..1be5080d4b 100644 --- a/public/src/client/topic/posts.js +++ b/public/src/client/topic/posts.js @@ -100,7 +100,8 @@ define('forum/topic/posts', [ ) || (ajaxify.data.pagination.currentPage === 1 && direction === -1); if (isPostVisible) { - createNewPosts(data, components.get('post').not('[data-index=0]'), direction, false, scrollToPost); + var repliesSelector = $('[component="post"]:not([data-index=0]), [component="topic/event"]'); + createNewPosts(data, repliesSelector, direction, false, scrollToPost); } else if (ajaxify.data.scrollToMyPost && parseInt(posts[0].uid, 10) === parseInt(app.user.uid, 10)) { // https://github.com/NodeBB/NodeBB/issues/5004#issuecomment-247157441 setTimeout(function () { @@ -130,8 +131,8 @@ define('forum/topic/posts', [ if (!isPreviousPostAdded && data.posts[0].selfPost) { return ajaxify.go('post/' + data.posts[0].pid); } - - createNewPosts(data, components.get('post').not('[data-index=0]'), direction, false, function (html) { + var repliesSelector = $('[component="post"]:not([data-index=0]), [component="topic/event"]'); + createNewPosts(data, repliesSelector, direction, false, function (html) { if (html) { html.addClass('new'); } @@ -264,7 +265,8 @@ define('forum/topic/posts', [ indicatorEl.fadeOut(); if (data && data.posts && data.posts.length) { - createNewPosts(data, replies, direction, true, done); + var repliesSelector = $('[component="post"]:not([data-index=0]):not(.new), [component="topic/event"]'); + createNewPosts(data, repliesSelector, direction, true, done); } else { navigator.update(); done();