diff --git a/web/src/lib/components/album-page/album-options.svelte b/web/src/lib/components/album-page/album-options.svelte index 53fd355c4b0db..3ec1842757201 100644 --- a/web/src/lib/components/album-page/album-options.svelte +++ b/web/src/lib/components/album-page/album-options.svelte @@ -6,6 +6,8 @@ type AlbumResponseDto, type UserResponseDto, AssetOrder, + AlbumUserRole, + updateAlbumUser, } from '@immich/sdk'; import { mdiArrowDownThin, mdiArrowUpThin, mdiPlus, mdiDotsVertical } from '@mdi/js'; import FullScreenModal from '$lib/components/shared-components/full-screen-modal.svelte'; @@ -29,6 +31,7 @@ export let onToggleEnabledActivity: () => void; export let onShowSelectSharedUser: () => void; export let onRemove: (userId: string) => void; + export let onRefreshAlbum: () => void; let selectedRemoveUser: UserResponseDto | null = null; @@ -80,6 +83,21 @@ selectedRemoveUser = null; } }; + + const handleUpdateSharedUserRole = async (user: UserResponseDto, role: AlbumUserRole) => { + try { + await updateAlbumUser({ id: album.id, userId: user.id, updateAlbumUserDto: { role } }); + const message = $t('user_role_set', { + values: { user: user.name, role: role == AlbumUserRole.Viewer ? $t('role_viewer') : $t('role_editor') }, + }); + onRefreshAlbum(); + notificationController.show({ type: NotificationType.Info, message }); + } catch (error) { + handleError(error, $t('errors.unable_to_change_album_user_role')); + } finally { + selectedRemoveUser = null; + } + }; {#if !selectedRemoveUser} @@ -122,15 +140,31 @@