From 6f030b04fd3f5b7237e14570f04fe4e7c0e9705f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Calvi=C3=B1o=20S=C3=A1nchez?= Date: Mon, 19 Jan 2026 12:40:11 +0100 Subject: [PATCH 1/2] fix: Fix handling of deleting share from self MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If a share is deleted from self and it is not a group share it was handled as a user share. However, other types of shares can be deleted from self (for example, circle or room shares), so user shares need to be explicitly checked. Note that as those other share types are not explicitly handled no entry is added to the activity for them, but that was already the case before (this change just prevents an exception to be thrown). Signed-off-by: Daniel Calviño Sánchez --- lib/FilesHooks.php | 2 +- tests/FilesHooksTest.php | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/FilesHooks.php b/lib/FilesHooks.php index 0d2454bda..4a5677dc6 100644 --- a/lib/FilesHooks.php +++ b/lib/FilesHooks.php @@ -825,7 +825,7 @@ public function unShareSelf(IShare $share) { if (in_array($share->getNodeType(), ['file', 'folder'], true)) { if ($share->getShareType() === IShare::TYPE_GROUP) { $this->unshareFromSelfGroup($share); - } else { + } elseif ($share->getShareType() === IShare::TYPE_USER) { $this->unshareFromUser($share); } } diff --git a/tests/FilesHooksTest.php b/tests/FilesHooksTest.php index 19c23b8ce..5f3fbe09a 100644 --- a/tests/FilesHooksTest.php +++ b/tests/FilesHooksTest.php @@ -1038,6 +1038,8 @@ public function testLeaveShare(): void { ->willReturn('file'); $share->method('getSharedWith') ->willReturn('with'); + $share->method('getShareType') + ->willReturn(IShare::TYPE_USER); $this->settings->expects($this->exactly(3)) ->method('getUserSetting') From 6408f29376b3d0aadbba0fd78d47fb79e44d4699 Mon Sep 17 00:00:00 2001 From: Anna Larch Date: Thu, 19 Feb 2026 14:37:04 +0100 Subject: [PATCH 2/2] fix(psalm): return empty array if query returns no results Signed-off-by: Anna Larch --- lib/Data.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Data.php b/lib/Data.php index da17a6177..5e7c38496 100644 --- a/lib/Data.php +++ b/lib/Data.php @@ -437,7 +437,7 @@ public function getActivitySince(string $user, int $since, bool $byOthers) { $query->andWhere($query->expr()->neq('user', $nameParam)); } - return $query->executeQuery()->fetch(); + return $query->executeQuery()->fetch() ?: []; } /**