Skip to content
This repository was archived by the owner on Jan 23, 2025. It is now read-only.

Commit 675de87

Browse files
committed
fix paging on /users/tops so max page size can't be overriden
1 parent 011bd7c commit 675de87

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

actions/tops.js

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -526,8 +526,7 @@ exports.getTopTrackMembers = {
526526
dbConnectionMap = connection.dbConnectionMap,
527527
result = {},
528528
error,
529-
sqlParams = {},
530-
isNoPaging;
529+
sqlParams = {};
531530
if (!dbConnectionMap) {
532531
helper.handleNoConnection(api, connection, next);
533532
return;
@@ -549,8 +548,7 @@ exports.getTopTrackMembers = {
549548
}
550549
if (pageIndex === -1) {
551550
pageIndex = 1;
552-
pageSize = MAX_INT; // No paging, show all.
553-
isNoPaging = true;
551+
pageSize = MAX_PAGE_SIZE; // No paging, show max allowed.
554552
}
555553
// Retrieves total number of top members for the given track.
556554
api.dataAccess.executeQuery('get_top_members_' + trackType + '_count', sqlParams, dbConnectionMap, cb);
@@ -559,10 +557,9 @@ exports.getTopTrackMembers = {
559557
cb(new Error('no rows returned from get_top_members_' + trackType + '_count'));
560558
return;
561559
}
562-
var total = rows[0].count;
563-
result.total = total;
560+
result.total = rows[0].count;
564561
result.pageIndex = pageIndex;
565-
result.pageSize = isNoPaging ? total : pageSize;
562+
result.pageSize = pageSize;
566563
result.data = [];
567564
sqlParams.firstRowIndex = (pageIndex - 1) * pageSize;
568565
sqlParams.pageSize = pageSize;

0 commit comments

Comments
 (0)