summaryrefslogtreecommitdiffstats
path: root/core/js/files
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2016-09-12 17:09:46 +0200
committerRoeland Jago Douma <roeland@famdouma.nl>2016-10-19 11:06:29 +0200
commit361f008c705009eee8d7435f46095760ac706456 (patch)
tree95e7033befa4ff0fc20e60f5df2a4b249575d636 /core/js/files
parent5e48ce98c70fa511ea2c1caeb332594912c9d96a (diff)
downloadnextcloud-server-361f008c705009eee8d7435f46095760ac706456.tar.gz
nextcloud-server-361f008c705009eee8d7435f46095760ac706456.zip
Make it possible to filter by tags with REPORT method
Enhanced the REPORT method on the Webdav endpoint and added a "oc:favorite" filter rule. When set, it will return a flat list of results filtered with only favorite files. The web UI was also adjusted to use this REPORT method instead of the private API endpoint. Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'core/js/files')
-rw-r--r--core/js/files/client.js6
1 files changed, 5 insertions, 1 deletions
diff --git a/core/js/files/client.js b/core/js/files/client.js
index a195258afbb..572f7879e17 100644
--- a/core/js/files/client.js
+++ b/core/js/files/client.js
@@ -437,6 +437,7 @@
*
* @param {Object} filter filter criteria
* @param {Object} [filter.systemTagIds] list of system tag ids to filter by
+ * @param {bool} [filter.favorite] set it to filter by favorites
* @param {Object} [options] options
* @param {Array} [options.properties] list of Webdav properties to retrieve
*
@@ -454,7 +455,7 @@
properties = options.properties;
}
- if (!filter || !filter.systemTagIds || !filter.systemTagIds.length) {
+ if (!filter || (!filter.systemTagIds && _.isUndefined(filter.favorite))) {
throw 'Missing filter argument';
}
@@ -480,6 +481,9 @@
_.each(filter.systemTagIds, function(systemTagIds) {
body += ' <oc:systemtag>' + escapeHTML(systemTagIds) + '</oc:systemtag>\n';
});
+ if (filter.favorite) {
+ body += ' <oc:favorite>' + (filter.favorite ? '1': '0') + '</oc:favorite>\n';
+ }
body += ' </oc:filter-rules>\n';
// end of root