Skip to content

Node.js based forum software built for the modern web

fix: recent chat pagination, closes #12637

Barış Soner Uşaklıf7c9b7ae4e55
diff --git a/public/src/client/chats/recent.js b/public/src/client/chats/recent.js
index b9b7e1b678..24fa82f951 100644
--- a/public/src/client/chats/recent.js
+++ b/public/src/client/chats/recent.js
@@ -37,7 +37,7 @@ define('forum/chats/recent', ['alerts', 'api', 'chat'], function (alerts, api, c
recentChats.attr('loading', 1);
api.get(`/chats`, {
uid: ajaxify.data.uid,
- after: recentChats.attr('data-nextstart'),
+ start: recentChats.attr('data-nextstart'),
}).then(({ rooms, nextStart }) => {
if (rooms.length) {
onRecentChatsLoaded({ rooms, nextStart }, function () {
diff --git a/src/controllers/write/chats.js b/src/controllers/write/chats.js
index ae21235f88..81f4fb27e8 100644
--- a/src/controllers/write/chats.js
+++ b/src/controllers/write/chats.js
@@ -10,7 +10,7 @@ Chats.list = async (req, res) => {
let { page, perPage, start, uid } = req.query;
([page, perPage, start, uid] = [page, perPage, start, uid].map(value => isFinite(value) && parseInt(value, 10)));
page = page || 1;
- perPage = perPage || 20;
+ perPage = Math.min(100, perPage || 20);
// start supercedes page
if (start) {