Fix collectLight() : inclure author, text, location pour l'affichage
Problème : collectLight() ne retournait que id/type/isRead/date, causant notification.author undefined dans le frontend. Solution : Inclure tous les champs nécessaires à l'affichage (author, text, location) mais toujours alléger en excluant les gros détails inutiles. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
2791bc4462
commit
86db1f5a0c
1 changed files with 22 additions and 7 deletions
|
|
@ -59,7 +59,7 @@ class NotificationCollector
|
|||
|
||||
/**
|
||||
* Collecte uniquement les données minimales des notifications (version allégée pour listing).
|
||||
* Retourne seulement id, type, isRead, date pour économiser la mémoire.
|
||||
* Retourne les champs nécessaires à l'affichage mais sans les détails lourds.
|
||||
*
|
||||
* @param Page $project Le projet à scanner
|
||||
* @param User $user L'utilisateur courant
|
||||
|
|
@ -72,18 +72,33 @@ class NotificationCollector
|
|||
foreach ($this->providers as $provider) {
|
||||
try {
|
||||
$notifications = $provider->collect($project, $user);
|
||||
// Ne garder que les champs essentiels
|
||||
// Garder les champs nécessaires au frontend
|
||||
foreach ($notifications as $notification) {
|
||||
$all[] = [
|
||||
$light = [
|
||||
'id' => $notification['id'] ?? null,
|
||||
'type' => $notification['type'] ?? null,
|
||||
'isRead' => $notification['isRead'] ?? false,
|
||||
'date' => $notification['date'] ?? null,
|
||||
// Garder location.project.uri pour le frontend
|
||||
'location' => [
|
||||
'project' => $notification['location']['project'] ?? []
|
||||
]
|
||||
'text' => $notification['text'] ?? null,
|
||||
'author' => $notification['author'] ?? null,
|
||||
'location' => $notification['location'] ?? []
|
||||
];
|
||||
|
||||
// Garder les champs optionnels s'ils existent
|
||||
if (isset($notification['dialogUri'])) {
|
||||
$light['dialogUri'] = $notification['dialogUri'];
|
||||
}
|
||||
if (isset($notification['_briefUri'])) {
|
||||
$light['_briefUri'] = $notification['_briefUri'];
|
||||
}
|
||||
if (isset($notification['_file'])) {
|
||||
$light['_file'] = $notification['_file'];
|
||||
}
|
||||
if (isset($notification['_projectUri'])) {
|
||||
$light['_projectUri'] = $notification['_projectUri'];
|
||||
}
|
||||
|
||||
$all[] = $light;
|
||||
}
|
||||
} catch (\Throwable $e) {
|
||||
error_log("NotificationCollector: Error in {$provider->getType()}: " . $e->getMessage());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue