1
0
mirror of https://github.com/immich-app/immich.git synced 2025-08-08 23:07:06 +02:00

Initial look at fixing issue where images are uploaded to the wrong album if a shared album conflicts with a local users album.

This commit is contained in:
Tom graham
2025-01-07 18:00:35 +11:00
parent 9bc13aca7c
commit 81c1a4f1da
2 changed files with 6 additions and 6 deletions

View File

@ -46,8 +46,8 @@ class AlbumNotifier extends StateNotifier<List<Album>> {
) => ) =>
_albumService.createAlbum(albumTitle, assets, []); _albumService.createAlbum(albumTitle, assets, []);
Future<Album?> getAlbumByName(String albumName, {bool remoteOnly = false}) => Future<Album?> getAlbumByName(String albumName, {bool? remote, bool? shared}) =>
_albumService.getAlbumByName(albumName, remoteOnly); _albumService.getAlbumByName(albumName, remote: remote, shared: shared);
/// Create an album on the server with the same name as the selected album for backup /// Create an album on the server with the same name as the selected album for backup
/// First this will check if the album already exists on the server with name /// First this will check if the album already exists on the server with name
@ -55,7 +55,7 @@ class AlbumNotifier extends StateNotifier<List<Album>> {
Future<void> createSyncAlbum( Future<void> createSyncAlbum(
String albumName, String albumName,
) async { ) async {
final album = await getAlbumByName(albumName, remoteOnly: true); final album = await getAlbumByName(albumName, remote: true, shared: false);
if (album != null) { if (album != null) {
return; return;
} }

View File

@ -408,8 +408,8 @@ class AlbumService {
} }
} }
Future<Album?> getAlbumByName(String name, bool remoteOnly) => Future<Album?> getAlbumByName(String name, {bool? remote, bool? shared}) =>
_albumRepository.getByName(name, remote: remoteOnly ? true : null); _albumRepository.getByName(name, remote: remote, shared: shared);
/// ///
/// Add the uploaded asset to the selected albums /// Add the uploaded asset to the selected albums
@ -419,7 +419,7 @@ class AlbumService {
List<String> assetIds, List<String> assetIds,
) async { ) async {
for (final albumName in albumNames) { for (final albumName in albumNames) {
Album? album = await getAlbumByName(albumName, true); Album? album = await getAlbumByName(albumName, remote: true, shared: false);
album ??= await createAlbum(albumName, []); album ??= await createAlbum(albumName, []);
if (album != null && album.remoteId != null) { if (album != null && album.remoteId != null) {
await _albumApiRepository.addAssets(album.remoteId!, assetIds); await _albumApiRepository.addAssets(album.remoteId!, assetIds);