Skip to content

Commit 29918ef

Browse files
blizzzbackportbot-nextcloud[bot]
authored andcommitted
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 <[email protected]>
1 parent db1306b commit 29918ef

File tree

4 files changed

+8
-2
lines changed

4 files changed

+8
-2
lines changed

apps/dav/lib/Connector/Sabre/FilesReportPlugin.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ protected function processFilterRulesForFileNodes(array $filterRules, ?int $limi
336336

337337
// type check to ensure searchBySystemTag is available, it is not
338338
// exposed in API yet
339-
if (!empty($systemTagIds)) {
339+
if (!empty($systemTagIds) && method_exists($this->userFolder, 'searchBySystemTag')) {
340340
$tags = $this->tagManager->getTagsByIds($systemTagIds, $this->userSession->getUser());
341341

342342
// For we run DB queries per tag and require intersection, we cannot apply limit and offset for DB queries on multi tag search.

apps/dav/tests/unit/Connector/Sabre/FilesReportPluginTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,8 @@ protected function setUp(): void {
114114

115115
$this->userFolder = $this->getMockBuilder(Folder::class)
116116
->disableOriginalConstructor()
117+
->addMethods(['searchBySystemTag'])
118+
->onlyMethods(get_class_methods(Folder::class))
117119
->getMock();
118120

119121
$this->previewManager = $this->getMockBuilder(IPreview::class)

lib/private/Files/Node/LazyFolder.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -448,6 +448,10 @@ public function searchByTag($tag, $userId) {
448448
return $this->__call(__FUNCTION__, func_get_args());
449449
}
450450

451+
public function searchBySystemTag(string $tagName, string $userId, int $limit = 0, int $offset = 0): array {
452+
return $this->__call(__FUNCTION__, func_get_args());
453+
}
454+
451455
/**
452456
* @inheritDoc
453457
*/

lib/public/SystemTag/ISystemTagManager.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ interface ISystemTagManager {
4646
* @throws TagNotFoundException if at least one given tag ids did no exist
4747
* The message contains a json_encoded array of the ids that could not be found
4848
*
49-
* @since 9.0.0, optional parameter $user added in 28.0.0
49+
* @since 9.0.0, optional parameter $user added in 27.0.1
5050
*/
5151
public function getTagsByIds($tagIds, ?IUser $user = null): array;
5252

0 commit comments

Comments
 (0)