Skip to content

Commit

Permalink
fix: use owner instead of owner_id to delete photos by owner
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
  • Loading branch information
kesselb authored and artonge committed Jun 6, 2023
1 parent c2a98c2 commit 041dfa8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/Album/AlbumMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -298,15 +298,15 @@ public function removeFileWithOwner(int $fileId, string $ownerId): void {
$query = $this->connection->getQueryBuilder();
$albumsRows = $query->select('album_id')
->from("photos_albums_files")
->where($query->expr()->eq("owner_id", $query->createNamedParameter($ownerId)))
->where($query->expr()->eq("owner", $query->createNamedParameter($ownerId)))
->andWhere($query->expr()->eq("file_id", $query->createNamedParameter($fileId, IQueryBuilder::PARAM_INT)))
->executeQuery()
->fetchAll();

// Remove any occurrence of fileId when owner is ownerId.
$query = $this->connection->getQueryBuilder();
$query->delete("photos_albums_files")
->where($query->expr()->eq("owner_id", $query->createNamedParameter($ownerId)))
->where($query->expr()->eq("owner", $query->createNamedParameter($ownerId)))
->andWhere($query->expr()->eq("file_id", $query->createNamedParameter($fileId, IQueryBuilder::PARAM_INT)))
->executeStatement();

Expand Down

0 comments on commit 041dfa8

Please sign in to comment.