mirror of
https://github.com/immich-app/immich
synced 2026-08-15 13:03:57 +00:00
fix(web): accept invitation
This commit is contained in:
parent
cb6114d13f
commit
7042c63ed1
3 changed files with 21 additions and 14 deletions
|
|
@ -1035,7 +1035,6 @@
|
|||
"unable_to_delete_album": "Unable to delete album",
|
||||
"unable_to_delete_asset": "Unable to delete asset",
|
||||
"unable_to_delete_assets": "Error deleting assets",
|
||||
"unable_to_delete_cluster_group_request": "Unable to delete request",
|
||||
"unable_to_delete_exclusion_pattern": "Unable to delete exclusion pattern",
|
||||
"unable_to_delete_shared_link": "Unable to delete shared link",
|
||||
"unable_to_delete_user": "Unable to delete user",
|
||||
|
|
|
|||
|
|
@ -4,10 +4,10 @@
|
|||
import { Button, HStack, LoadingSpinner, Modal, ModalBody, ModalFooter, Text } from '@immich/ui';
|
||||
import { t } from 'svelte-i18n';
|
||||
|
||||
interface Props {
|
||||
type Props = {
|
||||
clusterGroupId: string;
|
||||
onClose: (result?: 'accept' | 'decline') => void;
|
||||
}
|
||||
};
|
||||
|
||||
let { clusterGroupId, onClose }: Props = $props();
|
||||
|
||||
|
|
@ -18,8 +18,7 @@
|
|||
};
|
||||
</script>
|
||||
|
||||
<!-- closing the modal leaves the request alone, so only the buttons decide its fate -->
|
||||
<Modal title={$t('cluster_group')} onClose={() => onClose()} size="small">
|
||||
<Modal title={$t('cluster_group')} {onClose} size="small">
|
||||
<ModalBody>
|
||||
{#await loadUsers()}
|
||||
<div class="flex w-full place-content-center place-items-center">
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
import { authManager } from '$lib/managers/auth-manager.svelte';
|
||||
import { handleError } from '$lib/utils/handle-error';
|
||||
import {
|
||||
acceptClusterGroupRequest,
|
||||
createClusterGroupRequest,
|
||||
createPartner,
|
||||
deleteClusterGroupRequest,
|
||||
|
|
@ -82,10 +83,7 @@
|
|||
|
||||
try {
|
||||
for (const user of selected) {
|
||||
await createClusterGroupRequest({
|
||||
id: clusterGroupId,
|
||||
clusterGroupRequestCreateDto: { userId: user.id },
|
||||
});
|
||||
await createClusterGroupRequest({ id: clusterGroupId, clusterGroupRequestCreateDto: { userId: user.id } });
|
||||
}
|
||||
|
||||
await refresh();
|
||||
|
|
@ -95,7 +93,21 @@
|
|||
};
|
||||
|
||||
const handleViewGroup = async (request: ClusterGroupRequestResponseDto) => {
|
||||
await modalManager.show(ClusterGroupUsersModal, { clusterGroupId: request.clusterGroupId });
|
||||
const result = await modalManager.show(ClusterGroupUsersModal, { clusterGroupId: request.clusterGroupId });
|
||||
if (result === 'accept') {
|
||||
await handleAcceptRequest(request);
|
||||
} else if (result === 'decline') {
|
||||
handleDeleteRequest(request);
|
||||
}
|
||||
};
|
||||
|
||||
const handleAcceptRequest = async (request: ClusterGroupRequestResponseDto) => {
|
||||
try {
|
||||
await acceptClusterGroupRequest({ id: request.id });
|
||||
await refresh();
|
||||
} catch (error) {
|
||||
handleError(error, $t('errors.something_went_wrong'));
|
||||
}
|
||||
};
|
||||
|
||||
const handleDeleteRequest = async (request: ClusterGroupRequestResponseDto) => {
|
||||
|
|
@ -103,7 +115,7 @@
|
|||
await deleteClusterGroupRequest({ id: request.id });
|
||||
await refresh();
|
||||
} catch (error) {
|
||||
handleError(error, $t('errors.unable_to_delete_cluster_group_request'));
|
||||
handleError(error, $t('errors.something_went_wrong'));
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -257,9 +269,6 @@
|
|||
<Button shape="round" size="small" color="secondary" onclick={() => handleViewGroup(request)}>
|
||||
{$t('view_group')}
|
||||
</Button>
|
||||
<Button shape="round" size="small" color="danger" onclick={() => handleDeleteRequest(request)}>
|
||||
{$t('decline')}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
{/each}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue