From 1f34d5813ebbe7f2cd05a62fcdd410432e6b6abe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=B6rdle=20Bot?= Date: Wed, 3 Dec 2025 13:11:12 +0100 Subject: [PATCH] =?UTF-8?q?Fix:=20Kuratoren-Berechtigungscheck=20f=C3=BCr?= =?UTF-8?q?=20Specials=20vereinheitlicht?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/songs/route.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/api/songs/route.ts b/app/api/songs/route.ts index 6b16708..175a453 100644 --- a/app/api/songs/route.ts +++ b/app/api/songs/route.ts @@ -30,7 +30,9 @@ function curatorCanEditSong(context: StaffContext, song: any, assignments: { gen if (context.role === 'admin') return true; const songGenreIds = (song.genres || []).map((g: any) => g.id); - const songSpecialIds = (song.specials || []).map((s: any) => s.specialId ?? s.id); + // `song.specials` enthält bereits `Special`-Objekte mit einem `id`-Feld. + // Wir verwenden daher konsistent `s.id` statt eines (nicht existenten) `specialId`. + const songSpecialIds = (song.specials || []).map((s: any) => s.id); // Songs ohne Genres/Specials sind für Kuratoren generell editierbar if (songGenreIds.length === 0 && songSpecialIds.length === 0) { @@ -47,7 +49,7 @@ function curatorCanDeleteSong(context: StaffContext, song: any, assignments: { g if (context.role === 'admin') return true; const songGenreIds = (song.genres || []).map((g: any) => g.id); - const songSpecialIds = (song.specials || []).map((s: any) => s.specialId ?? s.id); + const songSpecialIds = (song.specials || []).map((s: any) => s.id); const allGenresAllowed = songGenreIds.every((id: number) => assignments.genreIds.has(id)); const allSpecialsAllowed = songSpecialIds.every((id: number) => assignments.specialIds.has(id));