diff --git a/lib/Data.php b/lib/Data.php index e8fa54492..c83440725 100644 --- a/lib/Data.php +++ b/lib/Data.php @@ -519,7 +519,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() ?: []; } /** diff --git a/lib/FilesHooks.php b/lib/FilesHooks.php index 8f7e75f78..d5d31c2b2 100644 --- a/lib/FilesHooks.php +++ b/lib/FilesHooks.php @@ -826,7 +826,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 00dfbff0d..b1ebafc83 100644 --- a/tests/FilesHooksTest.php +++ b/tests/FilesHooksTest.php @@ -962,6 +962,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')