Skip to content

Commit 828a2a5

Browse files
authored
Merge pull request #2387 from nextcloud/backport/2319/stable32
[stable32] fix: Fix handling of deleting share from self
2 parents 761bbb7 + d0c888f commit 828a2a5

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

lib/Data.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,7 @@ public function getActivitySince(string $user, int $since, bool $byOthers) {
519519
$query->andWhere($query->expr()->neq('user', $nameParam));
520520
}
521521

522-
return $query->executeQuery()->fetch();
522+
return $query->executeQuery()->fetch() ?: [];
523523
}
524524

525525
/**

lib/FilesHooks.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -826,7 +826,7 @@ public function unShareSelf(IShare $share) {
826826
if (in_array($share->getNodeType(), ['file', 'folder'], true)) {
827827
if ($share->getShareType() === IShare::TYPE_GROUP) {
828828
$this->unshareFromSelfGroup($share);
829-
} else {
829+
} elseif ($share->getShareType() === IShare::TYPE_USER) {
830830
$this->unshareFromUser($share);
831831
}
832832
}

tests/FilesHooksTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1024,6 +1024,8 @@ public function testLeaveShare(): void {
10241024
->willReturn('file');
10251025
$share->method('getSharedWith')
10261026
->willReturn('with');
1027+
$share->method('getShareType')
1028+
->willReturn(IShare::TYPE_USER);
10271029

10281030
$this->settings->expects($this->exactly(3))
10291031
->method('getUserSetting')

0 commit comments

Comments
 (0)