fix: add users to album (#24133)

pull/24137/head
Daniel Dietzler 2025-11-24 13:52:36 +07:00 committed by GitHub
parent 99505f987e
commit 57be3ff8c7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 12 deletions

@ -134,8 +134,6 @@
let albumGroupOption: string = $state(AlbumGroupBy.None); let albumGroupOption: string = $state(AlbumGroupBy.None);
let albumToShare: AlbumResponseDto | null = $state(null);
let contextMenuPosition: ContextMenuPosition = $state({ x: 0, y: 0 }); let contextMenuPosition: ContextMenuPosition = $state({ x: 0, y: 0 });
let selectedAlbum: AlbumResponseDto | undefined = $state(); let selectedAlbum: AlbumResponseDto | undefined = $state();
let isOpen = $state(false); let isOpen = $state(false);
@ -231,7 +229,7 @@
const result = await modalManager.show(AlbumShareModal, { album: selectedAlbum }); const result = await modalManager.show(AlbumShareModal, { album: selectedAlbum });
switch (result?.action) { switch (result?.action) {
case 'sharedUsers': { case 'sharedUsers': {
await handleAddUsers(result.data); await handleAddUsers(selectedAlbum, result.data);
break; break;
} }
@ -300,22 +298,17 @@
updateRecentAlbumInfo(album); updateRecentAlbumInfo(album);
}; };
const handleAddUsers = async (albumUsers: AlbumUserAddDto[]) => { const handleAddUsers = async (album: AlbumResponseDto, albumUsers: AlbumUserAddDto[]) => {
if (!albumToShare) {
return;
}
try { try {
const album = await addUsersToAlbum({ const updatedAlbum = await addUsersToAlbum({
id: albumToShare.id, id: album.id,
addUsersDto: { addUsersDto: {
albumUsers, albumUsers,
}, },
}); });
updateAlbumInfo(album); updateAlbumInfo(updatedAlbum);
} catch (error) { } catch (error) {
handleError(error, $t('errors.unable_to_add_album_users')); handleError(error, $t('errors.unable_to_add_album_users'));
} finally {
albumToShare = null;
} }
}; };