diff --git a/lib/ClustersBackend/AlbumsBackend.php b/lib/ClustersBackend/AlbumsBackend.php
index 2c09146d..e020e089 100644
--- a/lib/ClustersBackend/AlbumsBackend.php
+++ b/lib/ClustersBackend/AlbumsBackend.php
@@ -95,11 +95,12 @@ class AlbumsBackend extends Backend
// Run actual query
$list = [];
$t = (int) $request->getParam('t', 0);
+ $fileid = (int) $request->getParam('fid', -1);
if ($t & 1) { // personal
- $list = array_merge($list, $this->albumsQuery->getList(Util::getUID()));
+ $list = array_merge($list, $this->albumsQuery->getList(Util::getUID(), $fileid));
}
if ($t & 2) { // shared
- $list = array_merge($list, $this->albumsQuery->getList(Util::getUID(), true));
+ $list = array_merge($list, $this->albumsQuery->getList(Util::getUID(), $fileid, true));
}
// Remove elements with duplicate album_id
diff --git a/lib/Db/AlbumsQuery.php b/lib/Db/AlbumsQuery.php
index 830b73fc..dbcfec24 100644
--- a/lib/Db/AlbumsQuery.php
+++ b/lib/Db/AlbumsQuery.php
@@ -17,11 +17,16 @@ class AlbumsQuery
}
/** Get list of albums */
- public function getList(string $uid, bool $shared = false)
+ public function getList(string $uid, int $fileId, bool $shared = false)
{
$query = $this->connection->getQueryBuilder();
+ $allPhotosQuery = $this->connection->getQueryBuilder();
// SELECT everything from albums
+ $allPhotosQuery->select('album_id')->from('photos_albums_files');
+ $allPhotosQuery->where(
+ $allPhotosQuery->expr()->eq('file_id', $allPhotosQuery->createNamedParameter($fileId, IQueryBuilder::PARAM_INT))
+ );
$count = $query->func()->count($query->createFunction('DISTINCT m.fileid'), 'count');
$query->select(
'pa.album_id',
@@ -64,13 +69,21 @@ class AlbumsQuery
// FETCH all albums
$albums = $query->executeQuery()->fetchAll();
+ $allPhotos = $allPhotosQuery->executeQuery()->fetchAll();
+ $albumIds = array();
+
+ foreach ($allPhotos as &$album) {
+ $albumIds[$album['album_id']] = true;
+ }
// Post process
foreach ($albums as &$row) {
+ $albumId = (int) $row['album_id'];
$row['cluster_id'] = $row['user'].'/'.$row['name'];
- $row['album_id'] = (int) $row['album_id'];
+ $row['album_id'] = $albumId;
$row['created'] = (int) $row['created'];
$row['last_added_photo'] = (int) $row['last_added_photo'];
+ $row['has_file'] = !!$albumIds[$albumId];
}
return $albums;
diff --git a/src/assets/checkmark.svg b/src/assets/checkmark.svg
new file mode 100644
index 00000000..4beb9344
--- /dev/null
+++ b/src/assets/checkmark.svg
@@ -0,0 +1,5 @@
+
+
\ No newline at end of file
diff --git a/src/components/modal/AlbumPicker.vue b/src/components/modal/AlbumPicker.vue
index 4e9407ad..4f994296 100644
--- a/src/components/modal/AlbumPicker.vue
+++ b/src/components/modal/AlbumPicker.vue
@@ -3,20 +3,11 @@