albums: don't pass connection for no reason
parent
145d6affdd
commit
22d20756d7
|
@ -15,7 +15,7 @@ trait TimelineQueryAlbums
|
||||||
public function transformAlbumFilter(IQueryBuilder &$query, string $uid, string $albumId)
|
public function transformAlbumFilter(IQueryBuilder &$query, string $uid, string $albumId)
|
||||||
{
|
{
|
||||||
// Get album object
|
// Get album object
|
||||||
$album = $this->getAlbumIfAllowed($query->getConnection(), $uid, $albumId);
|
$album = $this->getAlbumIfAllowed($uid, $albumId);
|
||||||
|
|
||||||
// Check permission
|
// Check permission
|
||||||
if (null === $album) {
|
if (null === $album) {
|
||||||
|
@ -119,11 +119,10 @@ trait TimelineQueryAlbums
|
||||||
/**
|
/**
|
||||||
* Get album if allowed. Also check if album is shared with user.
|
* Get album if allowed. Also check if album is shared with user.
|
||||||
*
|
*
|
||||||
* @param IDBConnection $connection
|
|
||||||
* @param string $uid UID of CURRENT user
|
* @param string $uid UID of CURRENT user
|
||||||
* @param string $albumId $user/$name where $user is the OWNER of the album
|
* @param string $albumId $user/$name where $user is the OWNER of the album
|
||||||
*/
|
*/
|
||||||
private function getAlbumIfAllowed(IDBConnection $conn, string $uid, string $albumId)
|
private function getAlbumIfAllowed(string $uid, string $albumId)
|
||||||
{
|
{
|
||||||
// Split name and uid
|
// Split name and uid
|
||||||
$parts = explode('/', $albumId);
|
$parts = explode('/', $albumId);
|
||||||
|
@ -134,7 +133,7 @@ trait TimelineQueryAlbums
|
||||||
$albumName = $parts[1];
|
$albumName = $parts[1];
|
||||||
|
|
||||||
// Check if owner
|
// Check if owner
|
||||||
$query = $conn->getQueryBuilder();
|
$query = $this->connection->getQueryBuilder();
|
||||||
$query->select('*')->from('photos_albums')->where(
|
$query->select('*')->from('photos_albums')->where(
|
||||||
$query->expr()->andX(
|
$query->expr()->andX(
|
||||||
$query->expr()->eq('name', $query->createNamedParameter($albumName)),
|
$query->expr()->eq('name', $query->createNamedParameter($albumName)),
|
||||||
|
@ -152,7 +151,7 @@ trait TimelineQueryAlbums
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check in collaborators instead
|
// Check in collaborators instead
|
||||||
$query = $conn->getQueryBuilder();
|
$query = $this->connection->getQueryBuilder();
|
||||||
$query->select('album_id')->from($this->collaboratorsTable())->where(
|
$query->select('album_id')->from($this->collaboratorsTable())->where(
|
||||||
$query->expr()->andX(
|
$query->expr()->andX(
|
||||||
$query->expr()->eq('album_id', $query->createNamedParameter($album['album_id'])),
|
$query->expr()->eq('album_id', $query->createNamedParameter($album['album_id'])),
|
||||||
|
|
Loading…
Reference in New Issue