Fix: Kuratoren-Berechtigungscheck für Specials vereinheitlicht
This commit is contained in:
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user