mirror of
https://github.com/vale981/Vulcan
synced 2025-03-06 01:51:40 -05:00
get limit from terms
This commit is contained in:
parent
b709334cd6
commit
b129b4b826
1 changed files with 4 additions and 0 deletions
|
@ -22,6 +22,10 @@ getPostsParameters = function (terms) {
|
|||
// extend sort to sort posts by _id to break ties
|
||||
deepExtend(true, parameters, {options: {sort: {_id: -1}}});
|
||||
|
||||
// if a limit was provided with the terms, add it too (note: limit=0 means "no limit")
|
||||
if (typeof terms.limit !== 'undefined')
|
||||
_.extend(parameters.options, {limit: parseInt(terms.limit)});
|
||||
|
||||
// limit to "maxLimit" posts at most when limit is undefined, equal to 0, or superior to maxLimit
|
||||
if(!parameters.options.limit || parameters.options.limit == 0 || parameters.options.limit > maxLimit) {
|
||||
parameters.options.limit = maxLimit;
|
||||
|
|
Loading…
Add table
Reference in a new issue