mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 08:36:12 +01:00
fix: recent chat pagination, closes #12637
This commit is contained in:
@@ -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 () {
|
||||||
|
|||||||
@@ -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) {
|
||||||
|
|||||||
Reference in New Issue
Block a user