Skip to content

Node.js based forum software built for the modern web

closes #5190

barisusakli76254942b225
diff --git a/public/src/client/topic/posts.js b/public/src/client/topic/posts.js
index e6ed0f6bd7..4103864c0b 100644
--- a/public/src/client/topic/posts.js
+++ b/public/src/client/topic/posts.js
@@ -99,6 +99,11 @@ define('forum/topic/posts', [
function onNewPostInfiniteScroll(data) {
var direction = config.topicPostSort === 'oldest_to_newest' || config.topicPostSort === 'most_votes' ? 1 : -1;
+ var isPreviousPostAdded = $('[component="post"][data-index="' + (data.posts[0].index - 1) + '"]').length;
+ if (!isPreviousPostAdded && (!data.posts[0].selfPost || !ajaxify.data.scrollToMyPost)) {
+ return;
+ }
+
createNewPosts(data, components.get('post').not('[data-index=0]'), direction, function (html) {
if (html) {
html.addClass('new');
@@ -109,11 +114,7 @@ define('forum/topic/posts', [
}
function scrollToPostIfSelf(post) {
- if (!ajaxify.data.scrollToMyPost) {
- return;
- }
- var isSelfPost = parseInt(post.uid, 10) === parseInt(app.user.uid, 10);
- if (isSelfPost) {
+ if (post.selfPost && ajaxify.data.scrollToMyPost) {
navigator.scrollBottom(post.index);
}
}