Problème : projects.json.php collectait les notifications dérivées pour TOUS les projets d'un coup, ce qui causait un dépassement de mémoire (HTTP 500). Solution : - projects.json.php : Ne collecte plus les notifications (retourne []) - project.json.php : Collecte les notifications uniquement pour le projet affiché Les notifications seront chargées à la demande quand on ouvre un projet, pas lors du listing initial. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
35 lines
1.2 KiB
PHP
35 lines
1.2 KiB
PHP
<?php
|
|
|
|
// Récupérer le collector de notifications pour ce projet individuel
|
|
$notificationCollector = $kirby->option('adrienpayet.pdc-notifications.collector');
|
|
$notifications = [];
|
|
|
|
if ($notificationCollector && $kirby->user()) {
|
|
try {
|
|
$notifications = $notificationCollector->collect($page, $kirby->user());
|
|
} catch (\Throwable $e) {
|
|
error_log("Error collecting notifications for project {$page->uri()}: " . $e->getMessage());
|
|
$notifications = [];
|
|
}
|
|
}
|
|
|
|
$project = [
|
|
'title' => $page->title()->value(),
|
|
'url' => $page->url(),
|
|
'modified' => $page->modified('Y-MM-d'),
|
|
'status' => $page->status(),
|
|
'logo' => $page->client()->isNotEmpty() && $page->client()->toPage()
|
|
? $page->client()->toPage()->logo()->toFile()->url()
|
|
: null,
|
|
'steps' => $page->getSteps(),
|
|
'designToLight' => $page->isDTLEnabled()->isTrue() ? processDTLProposals($page) : null,
|
|
'hasOptimizationRequest' => $page->hasOptimizationRequest()->isTrue(),
|
|
'notifications' => $notifications,
|
|
];
|
|
|
|
$pageData = array_merge($genericData, $project);
|
|
|
|
echo json_encode([
|
|
'page' => $pageData,
|
|
'user' => $userData,
|
|
]);
|