summaryrefslogtreecommitdiffstats
path: root/core/js/oc-backbone-webdav.js
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2016-01-28 14:24:12 +0100
committerVincent Petry <pvince81@owncloud.com>2016-02-02 18:01:15 +0100
commit29386eccf96aec3e6a4c776f43e74c95474697bb (patch)
tree48675aa104747f87a6ebb1d4750cad13e434fde4 /core/js/oc-backbone-webdav.js
parentd1518045ecdf4dd006224256b25b292a92b1202d (diff)
downloadnextcloud-server-29386eccf96aec3e6a4c776f43e74c95474697bb.tar.gz
nextcloud-server-29386eccf96aec3e6a4c776f43e74c95474697bb.zip
Add pagination support for comments GUI
Diffstat (limited to 'core/js/oc-backbone-webdav.js')
-rw-r--r--core/js/oc-backbone-webdav.js22
1 files changed, 14 insertions, 8 deletions
diff --git a/core/js/oc-backbone-webdav.js b/core/js/oc-backbone-webdav.js
index 7c32116f011..d231a5b1ba0 100644
--- a/core/js/oc-backbone-webdav.js
+++ b/core/js/oc-backbone-webdav.js
@@ -76,6 +76,11 @@
* @param {Object} davProperties properties mapping
*/
function parsePropFindResult(result, davProperties) {
+ if (_.isArray(result)) {
+ return _.map(result, function(subResult) {
+ return parsePropFindResult(subResult, davProperties);
+ });
+ }
var props = {
href: result.href
};
@@ -151,15 +156,10 @@
if (isSuccessStatus(response.status)) {
if (_.isFunction(options.success)) {
var propsMapping = _.invert(options.davProperties);
- var results;
+ var results = parsePropFindResult(response.body, propsMapping);
if (options.depth > 0) {
- results = _.map(response.body, function(data) {
- return parsePropFindResult(data, propsMapping);
- });
// discard root entry
results.shift();
- } else {
- results = parsePropFindResult(response.body, propsMapping);
}
options.success(results);
@@ -217,7 +217,13 @@
options.success(responseJson);
return;
}
- options.success(result.body);
+ // if multi-status, parse
+ if (result.status === 207) {
+ var propsMapping = _.invert(options.davProperties);
+ options.success(parsePropFindResult(result.body, propsMapping));
+ } else {
+ options.success(result.body);
+ }
}
});
}
@@ -249,7 +255,7 @@
* DAV transport
*/
function davSync(method, model, options) {
- var params = {type: methodMap[method]};
+ var params = {type: methodMap[method] || method};
var isCollection = (model instanceof Backbone.Collection);
if (method === 'update' && (model.usePUT || (model.collection && model.collection.usePUT))) {