feat(invites): assign groups when creating an invite link (#566) #582

Merged
marcel merged 16 commits from feat/issue-566-invite-group-picker into main 2026-05-14 19:26:54 +02:00
2 changed files with 17 additions and 5 deletions
Showing only changes of commit acd66b1551 - Show all commits

View File

@@ -1,4 +1,5 @@
<script lang="ts">
import { untrack } from 'svelte';
import { m } from '$lib/paraglide/messages.js';
let {
@@ -9,7 +10,7 @@ let {
selectedGroupIds?: string[];
} = $props();
let selected = $state<string[]>([...selectedGroupIds]);
let selected = $state<string[]>(untrack(() => [...selectedGroupIds]));
</script>
<fieldset class="flex flex-wrap gap-3 border-none p-0">

View File

@@ -5,6 +5,17 @@ vi.mock('$env/dynamic/private', () => ({
}));
import { load, actions } from './+page.server';
import type { UserGroup } from './+page.server';
// PageServerLoad annotates the return as `void | (...)`. This explicit shape avoids
// the void and the Record<string, any> from the generic constraint.
type LoadData = {
invites: unknown[];
status: string;
loadError: string | null;
groups: UserGroup[];
groupsLoadError: string | null;
};
// eslint-disable-next-line @typescript-eslint/no-explicit-any
type AnyFetch = (...args: any[]) => any;
@@ -40,7 +51,7 @@ describe('admin/invites load()', () => {
])
);
const result = await load(event());
const result = (await load(event())) as LoadData;
expect(result.groups).toHaveLength(2);
expect(result.groupsLoadError).toBeNull();
@@ -55,7 +66,7 @@ describe('admin/invites load()', () => {
])
);
const result = await load(event());
const result = (await load(event())) as LoadData;
expect(result.groups.map((g) => g.name)).toEqual(['Alfa', 'Mitte', 'Zebra']);
});
@@ -65,7 +76,7 @@ describe('admin/invites load()', () => {
.mockResolvedValueOnce(mockResponse(true, []))
.mockResolvedValueOnce(mockResponse(false, { code: 'FORBIDDEN' }, 403));
const result = await load(event());
const result = (await load(event())) as LoadData;
expect(result.groups).toEqual([]);
expect(result.groupsLoadError).toBe('FORBIDDEN');
@@ -76,7 +87,7 @@ describe('admin/invites load()', () => {
.mockResolvedValueOnce(mockResponse(true, []))
.mockResolvedValueOnce(mockResponse(false, null, 500));
const result = await load(event());
const result = (await load(event())) as LoadData;
expect(result.groupsLoadError).toBe('INTERNAL_ERROR');
});