summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2014-12-12 11:18:35 +0100
committerVincent Petry <pvince81@owncloud.com>2014-12-12 11:18:35 +0100
commit15ecb28d50e5b8ce4100075caa52d96d4f00ae13 (patch)
tree02ca5b15c2a09afaa6a44a71fcf14d3c53184200 /apps
parent25dde7e93bc648ec8cd14b8f2711d50f77d8d1bf (diff)
downloadnextcloud-server-15ecb28d50e5b8ce4100075caa52d96d4f00ae13.tar.gz
nextcloud-server-15ecb28d50e5b8ce4100075caa52d96d4f00ae13.zip
Make $userId mandatory for searchByTags
$userId is now a mandatory parameter for searchByTags. Also fixed some places in the code where the argument was missing (Node API and View)
Diffstat (limited to 'apps')
-rw-r--r--apps/files_sharing/lib/cache.php2
-rw-r--r--apps/files_sharing/tests/cache.php5
2 files changed, 4 insertions, 3 deletions
diff --git a/apps/files_sharing/lib/cache.php b/apps/files_sharing/lib/cache.php
index da8155ec6fa..e3bee145876 100644
--- a/apps/files_sharing/lib/cache.php
+++ b/apps/files_sharing/lib/cache.php
@@ -351,7 +351,7 @@ class Shared_Cache extends Cache {
* @param string $userId owner of the tags
* @return array file data
*/
- public function searchByTag($tag, $userId = null) {
+ public function searchByTag($tag, $userId) {
// TODO: inject this
$tagger = \OC::$server->getTagManager()->load('files', null, null, $userId);
$result = array();
diff --git a/apps/files_sharing/tests/cache.php b/apps/files_sharing/tests/cache.php
index c40a014d557..b60bba73db8 100644
--- a/apps/files_sharing/tests/cache.php
+++ b/apps/files_sharing/tests/cache.php
@@ -208,17 +208,18 @@ class Test_Files_Sharing_Cache extends TestCase {
* Test searching by tag
*/
function testSearchByTag() {
+ $userId = \OC::$server->getUserSession()->getUser()->getUId();
$id1 = $this->sharedCache->get('bar.txt')['fileid'];
$id2 = $this->sharedCache->get('subdir/another too.txt')['fileid'];
$id3 = $this->sharedCache->get('subdir/not a text file.xml')['fileid'];
$id4 = $this->sharedCache->get('subdir/another.txt')['fileid'];
- $tagManager = \OC::$server->getTagManager()->load('files');
+ $tagManager = \OC::$server->getTagManager()->load('files', null, null, $userId);
$tagManager->tagAs($id1, 'tag1');
$tagManager->tagAs($id1, 'tag2');
$tagManager->tagAs($id2, 'tag1');
$tagManager->tagAs($id3, 'tag1');
$tagManager->tagAs($id4, 'tag2');
- $results = $this->sharedStorage->getCache()->searchByTag('tag1');
+ $results = $this->sharedStorage->getCache()->searchByTag('tag1', $userId);
$check = array(
array(
'name' => 'bar.txt',