Show all comments if limit/nested_limit set as inf

This commit is contained in:
Srijan Choudhary 2014-05-03 01:17:11 +05:30
parent baef73f1e8
commit 8879db59b8

View File

@ -129,12 +129,19 @@ define(["app/lib/promise", "app/globals"], function(Q, globals) {
}; };
var fetch = function(tid, limit, nested_limit, parent, lastcreated) { var fetch = function(tid, limit, nested_limit, parent, lastcreated) {
if(typeof(limit) == 'undefined') limit = 0; if(typeof(limit) == 'undefined') limit = "inf";
if(typeof(nested_limit) == 'undefined') nested_limit = 0; if(typeof(nested_limit) == 'undefined') nested_limit = "inf";
if(typeof(parent) == 'undefined') parent = null; if(typeof(parent) == 'undefined') parent = null;
var query_dict = {uri: tid || location, after: lastcreated, parent: parent};
if(limit != "inf") {
query_dict['limit'] = limit;
}
if(nested_limit != "inf"){
query_dict['nested_limit'] = nested_limit;
}
var deferred = Q.defer(); var deferred = Q.defer();
curl("GET", endpoint + "/?" + curl("GET", endpoint + "/?" +
qs({uri: tid || location, limit: limit, nested_limit: nested_limit, after: lastcreated, parent: parent}), null, function(rv) { qs(query_dict), null, function(rv) {
if (rv.status === 200) { if (rv.status === 200) {
deferred.resolve(JSON.parse(rv.body)); deferred.resolve(JSON.parse(rv.body));
} else if (rv.status === 404) { } else if (rv.status === 404) {