mirror of
https://github.com/immich-app/immich.git
synced 2025-12-22 17:24:56 +03:00
refactor: album users modal (#18266)
This commit is contained in:
@@ -369,7 +369,6 @@ export enum SettingInputFieldType {
|
||||
export const AlbumPageViewMode = {
|
||||
SELECT_THUMBNAIL: 'select-thumbnail',
|
||||
SELECT_ASSETS: 'select-assets',
|
||||
VIEW_USERS: 'view-users',
|
||||
VIEW: 'view',
|
||||
OPTIONS: 'options',
|
||||
};
|
||||
@@ -377,7 +376,6 @@ export const AlbumPageViewMode = {
|
||||
export type AlbumPageViewMode =
|
||||
| typeof AlbumPageViewMode.SELECT_THUMBNAIL
|
||||
| typeof AlbumPageViewMode.SELECT_ASSETS
|
||||
| typeof AlbumPageViewMode.VIEW_USERS
|
||||
| typeof AlbumPageViewMode.VIEW
|
||||
| typeof AlbumPageViewMode.OPTIONS;
|
||||
|
||||
|
||||
@@ -23,12 +23,10 @@
|
||||
|
||||
interface Props {
|
||||
album: AlbumResponseDto;
|
||||
onClose: () => void;
|
||||
onRemove: (userId: string) => void;
|
||||
onRefreshAlbum: () => void;
|
||||
onClose: (changed?: boolean) => void;
|
||||
}
|
||||
|
||||
let { album, onClose, onRemove, onRefreshAlbum }: Props = $props();
|
||||
let { album, onClose }: Props = $props();
|
||||
|
||||
let currentUser: UserResponseDto | undefined = $state();
|
||||
|
||||
@@ -71,12 +69,12 @@
|
||||
|
||||
try {
|
||||
await removeUserFromAlbum({ id: album.id, userId });
|
||||
onRemove(userId);
|
||||
const message =
|
||||
userId === 'me'
|
||||
? $t('album_user_left', { values: { album: album.albumName } })
|
||||
: $t('album_user_removed', { values: { user: user.name } });
|
||||
notificationController.show({ type: NotificationType.Info, message });
|
||||
onClose(true);
|
||||
} catch (error) {
|
||||
handleError(error, $t('errors.unable_to_remove_album_users'));
|
||||
}
|
||||
@@ -88,8 +86,9 @@
|
||||
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 });
|
||||
onClose(true);
|
||||
} catch (error) {
|
||||
handleError(error, $t('errors.unable_to_change_album_user_role'));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user