preview: fix for shared album
parent
ec19d724c5
commit
1866ce5dfa
|
@ -190,11 +190,14 @@ class ApiBase extends Controller
|
||||||
}
|
}
|
||||||
$uid = $user->getUID();
|
$uid = $user->getUID();
|
||||||
|
|
||||||
if (!$this->timelineQuery->albumHasUserFile($uid, $id)) {
|
$owner = $this->timelineQuery->albumHasUserFile($uid, $id);
|
||||||
|
if (!$owner) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->getOneFileFromFolder($this->rootFolder, $id);
|
$folder = $this->rootFolder->getUserFolder($owner);
|
||||||
|
|
||||||
|
return $this->getOneFileFromFolder($folder, $id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -118,11 +118,13 @@ trait TimelineQueryAlbums
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if a file belongs to a user through an album.
|
* Check if a file belongs to a user through an album.
|
||||||
|
*
|
||||||
|
* @return bool|string owner of file
|
||||||
*/
|
*/
|
||||||
public function albumHasUserFile(string $uid, int $fileId)
|
public function albumHasUserFile(string $uid, int $fileId)
|
||||||
{
|
{
|
||||||
$query = $this->connection->getQueryBuilder();
|
$query = $this->connection->getQueryBuilder();
|
||||||
$query->select('paf.album_id')->from('photos_albums_files', 'paf')->where(
|
$query->select('paf.owner')->from('photos_albums_files', 'paf')->where(
|
||||||
$query->expr()->andX(
|
$query->expr()->andX(
|
||||||
$query->expr()->eq('paf.file_id', $query->createNamedParameter($fileId, IQueryBuilder::PARAM_INT)),
|
$query->expr()->eq('paf.file_id', $query->createNamedParameter($fileId, IQueryBuilder::PARAM_INT)),
|
||||||
$query->expr()->orX(
|
$query->expr()->orX(
|
||||||
|
@ -144,7 +146,7 @@ trait TimelineQueryAlbums
|
||||||
$query->expr()->eq('pc.collaborator_id', $query->createNamedParameter($uid)),
|
$query->expr()->eq('pc.collaborator_id', $query->createNamedParameter($uid)),
|
||||||
));
|
));
|
||||||
|
|
||||||
return false !== $query->executeQuery()->fetchOne();
|
return $query->executeQuery()->fetchOne();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue