From 19752f516e3e87fa6d3a1fb0bb2c9e1b14ae8eeb Mon Sep 17 00:00:00 2001 From: isUnknown Date: Sun, 8 Mar 2026 18:53:37 +0100 Subject: [PATCH] fix: guard instanceof ProjectPage avant getNotificationsLight MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- public/site/templates/projects.json.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/public/site/templates/projects.json.php b/public/site/templates/projects.json.php index 6f589eb..4dd737e 100644 --- a/public/site/templates/projects.json.php +++ b/public/site/templates/projects.json.php @@ -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 = [