fix: guard instanceof ProjectPage avant getNotificationsLight
All checks were successful
Deploy Production / Build and Deploy to Production (push) Successful in 28s

Les projets avec un template non-project déclenchaient le __call magique
de Kirby qui retournait un Field object au lieu de lancer une exception,
cassant l'affichage des notifications côté frontend.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
isUnknown 2026-03-08 18:53:37 +01:00
parent 1fb4e47d8d
commit 19752f516e

View file

@ -11,11 +11,12 @@ function getProjectData($project, $user)
{
// Utiliser getNotificationsLight() avec cache pour optimiser les performances
$notifications = [];
try {
$notifications = $project->getNotificationsLight($user);
} catch (\Throwable $e) {
error_log("Error getting notifications for project {$project->uri()}: " . $e->getMessage());
$notifications = [];
if ($project instanceof ProjectPage) {
try {
$notifications = $project->getNotificationsLight($user);
} catch (\Throwable $e) {
error_log("Error getting notifications for project {$project->uri()}: " . $e->getMessage());
}
}
$data = [