mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 16:46:12 +01:00
fix: infinite scroll for posts
This commit is contained in:
@@ -256,7 +256,7 @@ define('forum/topic/posts', [
|
|||||||
const after = parseInt(afterEl.attr('data-index'), 10) || 0;
|
const after = parseInt(afterEl.attr('data-index'), 10) || 0;
|
||||||
|
|
||||||
const tid = ajaxify.data.tid;
|
const tid = ajaxify.data.tid;
|
||||||
if (!utils.isNumber(tid) || !utils.isNumber(after) || (direction < 0 && components.get('post', 'index', 0).length)) {
|
if (!utils.isNumber(after) || (direction < 0 && components.get('post', 'index', 0).length)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ const privileges = require('../../privileges');
|
|||||||
const meta = require('../../meta');
|
const meta = require('../../meta');
|
||||||
const utils = require('../../utils');
|
const utils = require('../../utils');
|
||||||
const social = require('../../social');
|
const social = require('../../social');
|
||||||
|
const activitypub = require('../../activitypub');
|
||||||
|
|
||||||
module.exports = function (SocketTopics) {
|
module.exports = function (SocketTopics) {
|
||||||
SocketTopics.loadMore = async function (socket, data) {
|
SocketTopics.loadMore = async function (socket, data) {
|
||||||
@@ -21,7 +22,8 @@ module.exports = function (SocketTopics) {
|
|||||||
throw new Error('[[error:no-privileges]]');
|
throw new Error('[[error:no-privileges]]');
|
||||||
}
|
}
|
||||||
|
|
||||||
const set = data.topicPostSort === 'most_votes' ? `tid:${data.tid}:posts:votes` : `tid:${data.tid}:posts`;
|
const setPrefix = activitypub.helpers.isUri(data.tid) ? 'tidRemote' : 'tid';
|
||||||
|
const set = data.topicPostSort === 'most_votes' ? `${setPrefix}:${data.tid}:posts:votes` : `${setPrefix}:${data.tid}:posts`;
|
||||||
const reverse = data.topicPostSort === 'newest_to_oldest' || data.topicPostSort === 'most_votes';
|
const reverse = data.topicPostSort === 'newest_to_oldest' || data.topicPostSort === 'most_votes';
|
||||||
let start = Math.max(0, parseInt(data.after, 10));
|
let start = Math.max(0, parseInt(data.after, 10));
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user