Fix albums for Photos v2.2.0
parent
e2e5375e53
commit
7458478f93
|
@ -39,7 +39,7 @@ trait TimelineQueryAlbums
|
|||
$query->select('pa.*', $count)->from('photos_albums', 'pa');
|
||||
|
||||
if ($shared) {
|
||||
$query->innerJoin('pa', 'photos_collaborators', 'pc', $query->expr()->andX(
|
||||
$query->innerJoin('pa', $this->collaboratorsTable(), 'pc', $query->expr()->andX(
|
||||
$query->expr()->eq('pa.album_id', 'pc.album_id'),
|
||||
$query->expr()->eq('pc.collaborator_id', $query->createNamedParameter($uid)),
|
||||
));
|
||||
|
@ -153,7 +153,7 @@ trait TimelineQueryAlbums
|
|||
|
||||
// Check in collaborators instead
|
||||
$query = $conn->getQueryBuilder();
|
||||
$query->select('album_id')->from('photos_collaborators')->where(
|
||||
$query->select('album_id')->from($this->collaboratorsTable())->where(
|
||||
$query->expr()->andX(
|
||||
$query->expr()->eq('album_id', $query->createNamedParameter($album['album_id'])),
|
||||
$query->expr()->eq('collaborator_id', $query->createNamedParameter($uid)),
|
||||
|
@ -164,4 +164,16 @@ trait TimelineQueryAlbums
|
|||
return $album;
|
||||
}
|
||||
}
|
||||
|
||||
/** Get the name of the collaborators table */
|
||||
private function collaboratorsTable() {
|
||||
// https://github.com/nextcloud/photos/commit/20e3e61ad577014e5f092a292c90a8476f630355
|
||||
$appManager = \OC::$server->getAppManager();
|
||||
$photosVersion = $appManager->getAppVersion('photos');
|
||||
if (version_compare($photosVersion, '2.2.0', '>=')) {
|
||||
return 'photos_albums_collabs';
|
||||
}
|
||||
|
||||
return 'photos_collaborators';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@ class Util
|
|||
return false;
|
||||
}
|
||||
|
||||
$v = $appManager->getAppInfo('photos')['version'];
|
||||
$v = $appManager->getAppVersion('photos');
|
||||
|
||||
return version_compare($v, '1.7.0', '>=');
|
||||
}
|
||||
|
@ -81,7 +81,7 @@ class Util
|
|||
return false;
|
||||
}
|
||||
|
||||
$v = $appManager->getAppInfo('recognize')['version'];
|
||||
$v = $appManager->getAppVersion('recognize');
|
||||
|
||||
return version_compare($v, '3.0.0-alpha', '>=');
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue