Skip to content

Commit

Permalink
refactor: adjust to unexposed searchBySystemTag
Browse files Browse the repository at this point in the history
- 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]>
  • Loading branch information
blizzz committed Jul 6, 2023
1 parent 35de0b5 commit da651ce
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion apps/dav/lib/Connector/Sabre/FilesReportPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ protected function processFilterRulesForFileNodes(array $filterRules, ?int $limi

// 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.
Expand Down
2 changes: 2 additions & 0 deletions apps/dav/tests/unit/Connector/Sabre/FilesReportPluginTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ protected function setUp(): void {

$this->userFolder = $this->getMockBuilder(Folder::class)
->disableOriginalConstructor()
->addMethods(['searchBySystemTag'])
->onlyMethods(get_class_methods(Folder::class))
->getMock();

$this->previewManager = $this->getMockBuilder(IPreview::class)
Expand Down
2 changes: 1 addition & 1 deletion lib/public/SystemTag/ISystemTagManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,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 27.0.1
*/
public function getTagsByIds($tagIds, ?IUser $user = null): array;

Expand Down

0 comments on commit da651ce

Please sign in to comment.