mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-03 12:36:02 +01:00
Loads posts if appropriate, but doesn't scroll to new post according to the scroll to my post setting. Addresses #4412.
This commit is contained in:
@@ -33,13 +33,11 @@ define('forum/topic/posts', [
|
|||||||
ajaxify.data.postcount ++;
|
ajaxify.data.postcount ++;
|
||||||
postTools.updatePostCount(ajaxify.data.postcount);
|
postTools.updatePostCount(ajaxify.data.postcount);
|
||||||
|
|
||||||
if (ajaxify.data.scrollToMyPost) {
|
|
||||||
if (config.usePagination) {
|
if (config.usePagination) {
|
||||||
onNewPostPagination(data);
|
onNewPostPagination(data);
|
||||||
} else {
|
} else {
|
||||||
onNewPostInfiniteScroll(data);
|
onNewPostInfiniteScroll(data);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
function updatePostCounts(posts) {
|
function updatePostCounts(posts) {
|
||||||
@@ -52,8 +50,10 @@ define('forum/topic/posts', [
|
|||||||
|
|
||||||
function onNewPostPagination(data) {
|
function onNewPostPagination(data) {
|
||||||
function scrollToPost() {
|
function scrollToPost() {
|
||||||
|
if (config.scrollToMyPost) {
|
||||||
scrollToPostIfSelf(data.posts[0]);
|
scrollToPostIfSelf(data.posts[0]);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var posts = data.posts;
|
var posts = data.posts;
|
||||||
|
|
||||||
@@ -64,7 +64,7 @@ define('forum/topic/posts', [
|
|||||||
|
|
||||||
if (isPostVisible) {
|
if (isPostVisible) {
|
||||||
createNewPosts(data, components.get('post').not('[data-index=0]'), direction, scrollToPost);
|
createNewPosts(data, components.get('post').not('[data-index=0]'), direction, scrollToPost);
|
||||||
} else if (parseInt(posts[0].uid, 10) === parseInt(app.user.uid, 10)) {
|
} else if (config.scrollToMyPost && parseInt(posts[0].uid, 10) === parseInt(app.user.uid, 10)) {
|
||||||
pagination.loadPage(ajaxify.data.pagination.pageCount, scrollToPost);
|
pagination.loadPage(ajaxify.data.pagination.pageCount, scrollToPost);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -81,6 +81,9 @@ define('forum/topic/posts', [
|
|||||||
}
|
}
|
||||||
|
|
||||||
function scrollToPostIfSelf(post) {
|
function scrollToPostIfSelf(post) {
|
||||||
|
if (!config.scrollToMyPost) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
var isSelfPost = parseInt(post.uid, 10) === parseInt(app.user.uid, 10);
|
var isSelfPost = parseInt(post.uid, 10) === parseInt(app.user.uid, 10);
|
||||||
if (isSelfPost) {
|
if (isSelfPost) {
|
||||||
navigator.scrollBottom(post.index);
|
navigator.scrollBottom(post.index);
|
||||||
|
|||||||
Reference in New Issue
Block a user