Skip to content

Commit

Permalink
Merge pull request #1853 from nextcloud/backport/1823/stable25
Browse files Browse the repository at this point in the history
[stable25] fix: properly handle public link share deletion
  • Loading branch information
artonge authored Jun 6, 2023
2 parents 4830783 + 8cb40ca commit 0d12590
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions lib/Listener/AlbumsManagementEventListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,13 @@ public function handle(Event $event): void {
}
} elseif ($event instanceof ShareDeletedEvent) {
$receiverId = $event->getShare()->getSharedWith();
$this->forEachSubNode(
$event->getShare()->getNode(),
// Remove node from any album when the owner is $receiverId.
fn ($node) => $this->albumMapper->removeFileWithOwner($node->getId(), $receiverId),
);
if ($receiverId !== null) { // null for public link shares
$this->forEachSubNode(
$event->getShare()->getNode(),
// Remove node from any album when the owner is $receiverId.
fn ($node) => $this->albumMapper->removeFileWithOwner($node->getId(), $receiverId),
);
}
} elseif ($event instanceof UserRemovedEvent) {
// Get all shared albums for this group:
$albums_group = $this->albumMapper->getSharedAlbumsForCollaborator($event->getGroup()->getGID(), AlbumMapper::TYPE_GROUP);
Expand Down

0 comments on commit 0d12590

Please sign in to comment.