diff options
author | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2023-07-06 22:33:20 +0200 |
---|---|---|
committer | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2023-07-07 17:56:54 +0200 |
commit | 33b9ba5cd9d305ec15dc37f0650402d25c019066 (patch) | |
tree | f39bfe79cc881a29bf2a91c681d46b3b0e707f79 | |
parent | 6256da1ade26e803887971424e113b8183f52d2a (diff) | |
download | nextcloud-server-33b9ba5cd9d305ec15dc37f0650402d25c019066.tar.gz nextcloud-server-33b9ba5cd9d305ec15dc37f0650402d25c019066.zip |
refactor: adjust to unexposed searchBySystemTag
- in this backport we have to drop the breaking addition in
\OCP\Files\Folder
- this requires adjustments in check for the existance of the method but
also in testing
- another change in \OCP\SystemTag\ISystemTagManager can be applied as
this interface is not implemented elsewhere
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
4 files changed, 8 insertions, 2 deletions
diff --git a/apps/dav/lib/Connector/Sabre/FilesReportPlugin.php b/apps/dav/lib/Connector/Sabre/FilesReportPlugin.php index 4b26d837779..1c6727e68ca 100644 --- a/apps/dav/lib/Connector/Sabre/FilesReportPlugin.php +++ b/apps/dav/lib/Connector/Sabre/FilesReportPlugin.php @@ -336,7 +336,7 @@ class FilesReportPlugin extends ServerPlugin { // type check to ensure searchBySystemTag is available, it is not // exposed in API yet - if (!empty($systemTagIds)) { + if (!empty($systemTagIds) && method_exists($this->userFolder, 'searchBySystemTag')) { $tags = $this->tagManager->getTagsByIds($systemTagIds, $this->userSession->getUser()); // For we run DB queries per tag and require intersection, we cannot apply limit and offset for DB queries on multi tag search. diff --git a/apps/dav/tests/unit/Connector/Sabre/FilesReportPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/FilesReportPluginTest.php index f1f1cc8b27f..2bbe7bef6de 100644 --- a/apps/dav/tests/unit/Connector/Sabre/FilesReportPluginTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/FilesReportPluginTest.php @@ -114,6 +114,8 @@ class FilesReportPluginTest extends \Test\TestCase { $this->userFolder = $this->getMockBuilder(Folder::class) ->disableOriginalConstructor() + ->addMethods(['searchBySystemTag']) + ->onlyMethods(get_class_methods(Folder::class)) ->getMock(); $this->previewManager = $this->getMockBuilder(IPreview::class) diff --git a/lib/private/Files/Node/LazyFolder.php b/lib/private/Files/Node/LazyFolder.php index fc17ed2eb52..859ac3439be 100644 --- a/lib/private/Files/Node/LazyFolder.php +++ b/lib/private/Files/Node/LazyFolder.php @@ -448,6 +448,10 @@ class LazyFolder implements \OCP\Files\Folder { return $this->__call(__FUNCTION__, func_get_args()); } + public function searchBySystemTag(string $tagName, string $userId, int $limit = 0, int $offset = 0): array { + return $this->__call(__FUNCTION__, func_get_args()); + } + /** * @inheritDoc */ diff --git a/lib/public/SystemTag/ISystemTagManager.php b/lib/public/SystemTag/ISystemTagManager.php index 3616bb1ef41..d28fef560aa 100644 --- a/lib/public/SystemTag/ISystemTagManager.php +++ b/lib/public/SystemTag/ISystemTagManager.php @@ -47,7 +47,7 @@ interface ISystemTagManager { * @throws TagNotFoundException if at least one given tag ids did no exist * The message contains a json_encoded array of the ids that could not be found * - * @since 9.0.0, optional parameter $user added in 28.0.0 + * @since 9.0.0, optional parameter $user added in 25.0.9 */ public function getTagsByIds($tagIds, ?IUser $user = null): array; |