fix: recent chat pagination, closes #12637

This commit is contained in:
Barış Soner Uşaklı
2024-06-14 09:52:11 -04:00
parent 6f79d30518
commit f7c9b7ae4e
2 changed files with 2 additions and 2 deletions

View File

@@ -37,7 +37,7 @@ define('forum/chats/recent', ['alerts', 'api', 'chat'], function (alerts, api, c
recentChats.attr('loading', 1); recentChats.attr('loading', 1);
api.get(`/chats`, { api.get(`/chats`, {
uid: ajaxify.data.uid, uid: ajaxify.data.uid,
after: recentChats.attr('data-nextstart'), start: recentChats.attr('data-nextstart'),
}).then(({ rooms, nextStart }) => { }).then(({ rooms, nextStart }) => {
if (rooms.length) { if (rooms.length) {
onRecentChatsLoaded({ rooms, nextStart }, function () { onRecentChatsLoaded({ rooms, nextStart }, function () {

View File

@@ -10,7 +10,7 @@ Chats.list = async (req, res) => {
let { page, perPage, start, uid } = req.query; let { page, perPage, start, uid } = req.query;
([page, perPage, start, uid] = [page, perPage, start, uid].map(value => isFinite(value) && parseInt(value, 10))); ([page, perPage, start, uid] = [page, perPage, start, uid].map(value => isFinite(value) && parseInt(value, 10)));
page = page || 1; page = page || 1;
perPage = perPage || 20; perPage = Math.min(100, perPage || 20);
// start supercedes page // start supercedes page
if (start) { if (start) {