Skip to content

Commit b0e688d

Browse files
author
Simon Spannagel
committed
Group deletion listener: use new mapper method
Signed-off-by: Simon Spannagel <[email protected]>
1 parent 7027273 commit b0e688d

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

lib/Listener/GroupDeletedListener.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public function handle(Event $event): void {
2020
}
2121

2222
// Get all shared albums for this group:
23-
$albums_group = $this->albumMapper->getSharedAlbumsForCollaboratorWithFiles($event->getGroup()->getGID(), AlbumMapper::TYPE_GROUP);
23+
$albums_group = $this->albumMapper->getSharedAlbumsForCollaborator($event->getGroup()->getGID(), AlbumMapper::TYPE_GROUP);
2424

2525
// Get all users of this group:
2626
$users = $event->getGroup()->getUsers();
@@ -29,20 +29,19 @@ public function handle(Event $event): void {
2929
$uid = $user->getUID();
3030

3131
// Get all albums shared with this specific user:
32-
$albums_user = $this->albumMapper->getSharedAlbumsForCollaboratorWithFiles($user->getUID(), AlbumMapper::TYPE_USER);
32+
$albums_user = $this->albumMapper->getSharedAlbumsForCollaborator($user->getUID(), AlbumMapper::TYPE_USER);
3333

3434
// Get all group-shared albums that are not directly shared with the removed user in addition
35-
$albums = array_udiff($albums_group, $albums_user, fn ($a, $b) => ($a->getAlbum()->getId() - $b->getAlbum()->getId()));
36-
35+
$albums = array_udiff($albums_group, $albums_user, fn ($a, $b) => ($a->getId() - $b->getId()));
3736

3837
// Remove their photos from theses albums:
3938
foreach ($albums as $album) {
40-
$this->albumMapper->removeFilesForUser($album->getAlbum()->getId(), $user->getUID());
39+
$this->albumMapper->removeFilesForUser($album->getId(), $user->getUID());
4140
}
4241
}
4342

4443
foreach ($albums_group as $album) {
45-
$this->albumMapper->deleteGroupFromAlbumCollaboratorsList($event->getGroup()->getGID(), $album->getAlbum()->getId());
44+
$this->albumMapper->deleteGroupFromAlbumCollaboratorsList($event->getGroup()->getGID(), $album->getId());
4645
}
4746
}
4847
}

lib/Listener/GroupUserRemovedListener.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,15 @@ public function handle(Event $event): void {
2020
}
2121

2222
// Get all shared albums for this group:
23-
$albums_group = $this->albumMapper->getSharedAlbumsForCollaboratorWithFiles($event->getGroup()->getGID(), AlbumMapper::TYPE_GROUP);
23+
$albums_group = $this->albumMapper->getSharedAlbumsForCollaborator($event->getGroup()->getGID(), AlbumMapper::TYPE_GROUP);
2424
// Get all albums shared with this specific user:
25-
$albums_user = $this->albumMapper->getSharedAlbumsForCollaboratorWithFiles($event->getUser()->getUID(), AlbumMapper::TYPE_USER);
25+
$albums_user = $this->albumMapper->getSharedAlbumsForCollaborator($event->getUser()->getUID(), AlbumMapper::TYPE_USER);
2626
// Get all group-shared albums that are not directly shared with the removed user in addition
27-
$albums = array_udiff($albums_group, $albums_user, fn ($a, $b) => ($a->getAlbum()->getId() - $b->getAlbum()->getId()));
27+
$albums = array_udiff($albums_group, $albums_user, fn ($a, $b) => ($a->getId() - $b->getId()));
2828

2929
// Remove their photos from theses albums:
3030
foreach ($albums as $album) {
31-
$this->albumMapper->removeFilesForUser($album->getAlbum()->getId(), $event->getUser()->getUID());
31+
$this->albumMapper->removeFilesForUser($album->getId(), $event->getUser()->getUID());
3232
}
3333
}
3434
}

0 commit comments

Comments
 (0)