fix: entity graph gaps, ANNOTATE_ALL on transcription blocks, CSRF on client fetch #648

Merged
marcel merged 14 commits from worktree-feat+issue-286-notification-bell-form-actions into main 2026-05-20 20:36:16 +02:00
2 changed files with 9 additions and 1 deletions
Showing only changes of commit 261cbbd867 - Show all commits

View File

@@ -71,7 +71,8 @@ export async function load({ fetch, url }) {
export const actions = {
'dismiss-notification': async ({ request, fetch }) => {
const data = await request.formData();
const notificationId = data.get('notificationId') as string;
const notificationId = data.get('notificationId') as string | null;
if (!notificationId) return fail(400, { error: 'Ungültige Benachrichtigungs-ID' });
const api = createApiClient(fetch);
const result = await api.PATCH('/api/notifications/{id}/read', {
params: { path: { id: notificationId } }

View File

@@ -185,6 +185,13 @@ function makeActionEvent(formData: FormData): any {
}
describe('aktivitaeten/actions — dismiss-notification', () => {
it('returns fail(400, { error }) and does NOT call PATCH when notificationId is missing', async () => {
const result = await actions['dismiss-notification'](makeActionEvent(new FormData()));
expect(result).toMatchObject({ status: 400 });
expect(mockApi.PATCH).not.toHaveBeenCalled();
});
it('calls PATCH /api/notifications/{id}/read with the form-supplied notificationId', async () => {
mockApi.PATCH.mockResolvedValue({ response: { ok: true }, data: {} });
const fd = new FormData();