diff options
author | Lukas Reschke <lukas@statuscode.ch> | 2016-10-20 18:32:51 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-10-20 18:32:51 +0200 |
commit | 0864f53675e00c6606f614c34bb0ccfc5e5409a4 (patch) | |
tree | 10d5f3138c84a0be982226e7582700f84779e4f6 /core/js | |
parent | ed4ed7911a9329462fef02c2d50709b3f092538e (diff) | |
parent | 361f008c705009eee8d7435f46095760ac706456 (diff) | |
download | nextcloud-server-0864f53675e00c6606f614c34bb0ccfc5e5409a4.tar.gz nextcloud-server-0864f53675e00c6606f614c34bb0ccfc5e5409a4.zip |
Merge pull request #1796 from nextcloud/oc_fav-report
Make it possible to filter by tags with REPORT method
Diffstat (limited to 'core/js')
-rw-r--r-- | core/js/files/client.js | 6 | ||||
-rw-r--r-- | core/js/tests/specs/files/clientSpec.js | 4 |
2 files changed, 6 insertions, 4 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 diff --git a/core/js/tests/specs/files/clientSpec.js b/core/js/tests/specs/files/clientSpec.js index 7673ec6e0fc..f75998029a9 100644 --- a/core/js/tests/specs/files/clientSpec.js +++ b/core/js/tests/specs/files/clientSpec.js @@ -461,9 +461,7 @@ describe('OC.Files.Client tests', function() { it('throws exception if arguments are missing', function() { var thrown = null; try { - client.getFilteredFiles({ - systemTagIds: [] - }); + client.getFilteredFiles({}); } catch (e) { thrown = true; } |