fix: , insert new posts after topic events

v1.18.x
Barış Soner Uşaklı
parent c354cde347
commit 60bf564321

@ -100,7 +100,8 @@ define('forum/topic/posts', [
) || (ajaxify.data.pagination.currentPage === 1 && direction === -1); ) || (ajaxify.data.pagination.currentPage === 1 && direction === -1);
if (isPostVisible) { 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)) { } else if (ajaxify.data.scrollToMyPost && parseInt(posts[0].uid, 10) === parseInt(app.user.uid, 10)) {
// https://github.com/NodeBB/NodeBB/issues/5004#issuecomment-247157441 // https://github.com/NodeBB/NodeBB/issues/5004#issuecomment-247157441
setTimeout(function () { setTimeout(function () {
@ -130,8 +131,8 @@ define('forum/topic/posts', [
if (!isPreviousPostAdded && data.posts[0].selfPost) { if (!isPreviousPostAdded && data.posts[0].selfPost) {
return ajaxify.go('post/' + data.posts[0].pid); return ajaxify.go('post/' + data.posts[0].pid);
} }
var repliesSelector = $('[component="post"]:not([data-index=0]), [component="topic/event"]');
createNewPosts(data, components.get('post').not('[data-index=0]'), direction, false, function (html) { createNewPosts(data, repliesSelector, direction, false, function (html) {
if (html) { if (html) {
html.addClass('new'); html.addClass('new');
} }
@ -264,7 +265,8 @@ define('forum/topic/posts', [
indicatorEl.fadeOut(); indicatorEl.fadeOut();
if (data && data.posts && data.posts.length) { 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 { } else {
navigator.update(); navigator.update();
done(); done();

Loading…
Cancel
Save