mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-03-06 20:41:17 +01:00
closes #2634
This commit is contained in:
@@ -20,16 +20,14 @@ define('forum/pagination', function() {
|
||||
};
|
||||
|
||||
pagination.loadPage = function(page, callback) {
|
||||
callback = callback || function() {};
|
||||
page = parseInt(page, 10);
|
||||
if(!utils.isNumber(page) || page < 1 || page > pagination.pageCount) {
|
||||
if (!utils.isNumber(page) || page < 1 || page > pagination.pageCount) {
|
||||
callback(false);
|
||||
return false;
|
||||
}
|
||||
|
||||
ajaxify.go(window.location.pathname.slice(1) + '?page=' + page, function() {
|
||||
if (typeof callback === 'function') {
|
||||
callback();
|
||||
}
|
||||
});
|
||||
var url = window.location.pathname.slice(1).split('/').slice(0, 3).join('/') + '?page=' + page;
|
||||
ajaxify.go(url, callback);
|
||||
return true;
|
||||
};
|
||||
|
||||
|
||||
@@ -31,11 +31,18 @@ define('forum/topic/posts', [
|
||||
};
|
||||
|
||||
function onNewPostPagination(data) {
|
||||
function scrollToPost() {
|
||||
navigator.scrollBottom(data.posts[0].index);
|
||||
}
|
||||
|
||||
var posts = data.posts;
|
||||
|
||||
pagination.pageCount = Math.max(1, Math.ceil((posts[0].topic.postcount - 1) / config.postsPerPage));
|
||||
|
||||
if (pagination.currentPage === pagination.pageCount) {
|
||||
createNewPosts(data);
|
||||
} else if(data.posts && data.posts.length && parseInt(data.posts[0].uid, 10) === parseInt(app.user.uid, 10)) {
|
||||
pagination.loadPage(pagination.pageCount);
|
||||
createNewPosts(data, scrollToPost);
|
||||
} else if (parseInt(posts[0].uid, 10) === parseInt(app.user.uid, 10)) {
|
||||
pagination.loadPage(pagination.pageCount, scrollToPost);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -243,7 +243,7 @@ module.exports = function(Topics) {
|
||||
posts.getUserInfoForPosts([postData.uid], uid, next);
|
||||
},
|
||||
topicInfo: function(next) {
|
||||
Topics.getTopicFields(tid, ['tid', 'title', 'slug', 'cid'], next);
|
||||
Topics.getTopicFields(tid, ['tid', 'title', 'slug', 'cid', 'postcount'], next);
|
||||
},
|
||||
settings: function(next) {
|
||||
user.getSettings(uid, next);
|
||||
|
||||
Reference in New Issue
Block a user