Fix : URL correcte pour notifications de brief validé depuis PDF + redirect briefs vides
Problème 1 : Les notifications de brief validé depuis un PDF renvoyaient vers /projects/xxx/client-brief au lieu de l'URL complète avec dialog et fileIndex. Problème 2 : Les URL /projects/xxx/client-brief pour des briefs non créés affichaient une page vide au lieu de rediriger vers le kanban. Solutions : - Stocker validationDialogUri lors de la validation du brief - Utiliser ce dialogUri dans ContentProvider et Notifications.vue - Rediriger vers le projet parent si brief vide et non validé Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
a7d315942a
commit
6ff59e9b07
6 changed files with 46 additions and 7 deletions
|
|
@ -24,7 +24,6 @@ tabs:
|
|||
type: hidden
|
||||
isValidated:
|
||||
type: hidden
|
||||
# Champs pour notification "content" (brief validé)
|
||||
validatedBy:
|
||||
type: hidden
|
||||
validatedByName:
|
||||
|
|
@ -35,6 +34,8 @@ tabs:
|
|||
type: hidden
|
||||
validationReadby:
|
||||
type: hidden
|
||||
validationDialogUri:
|
||||
type: hidden
|
||||
pdf:
|
||||
label: PDF
|
||||
type: files
|
||||
|
|
|
|||
|
|
@ -35,6 +35,8 @@ tabs:
|
|||
type: hidden
|
||||
validationReadby:
|
||||
type: hidden
|
||||
validationDialogUri:
|
||||
type: hidden
|
||||
pdf:
|
||||
label: PDF
|
||||
type: files
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ return [
|
|||
$timezone = new DateTimeZone('Europe/Paris');
|
||||
$dateTime = new DateTime('now', $timezone);
|
||||
|
||||
$newPage = $page->update([
|
||||
$updateData = [
|
||||
'isValidated' => 'true',
|
||||
// Métadonnées pour le système de notifications dérivées
|
||||
'validatedBy' => (string) $user->uuid(),
|
||||
|
|
@ -23,7 +23,14 @@ return [
|
|||
'validatedByEmail' => (string) $user->email(),
|
||||
'validatedAt' => $dateTime->format('Y-m-d\TH:i:sP'),
|
||||
'validationReadby' => [],
|
||||
]);
|
||||
];
|
||||
|
||||
// Si un dialogUri est fourni (validation depuis PDF), le stocker
|
||||
if (isset($data->dialogUri) && !empty($data->dialogUri)) {
|
||||
$updateData['validationDialogUri'] = (string) $data->dialogUri;
|
||||
}
|
||||
|
||||
$newPage = $page->update($updateData);
|
||||
|
||||
// Note: Les notifications sont maintenant dérivées.
|
||||
// Plus besoin d'appeler createNotification().
|
||||
|
|
|
|||
|
|
@ -60,10 +60,10 @@ class ContentProvider implements NotificationProvider
|
|||
? 'Brief client'
|
||||
: 'Brief étendu';
|
||||
|
||||
$notifications[] = [
|
||||
$notification = [
|
||||
'id' => 'content-' . (string) $step->uuid(),
|
||||
'type' => 'content',
|
||||
'text' => "Nouveau $stepLabel validé",
|
||||
'text' => 'Nouveau ' . strtolower($stepLabel) . ' validé',
|
||||
'author' => [
|
||||
'uuid' => $authorUuid,
|
||||
'name' => $step->validatedByName()->value() ?? '',
|
||||
|
|
@ -86,6 +86,13 @@ class ContentProvider implements NotificationProvider
|
|||
'isRead' => in_array($userUuid, $readby),
|
||||
'_briefUri' => $step->uri(),
|
||||
];
|
||||
|
||||
// Ajouter le dialogUri si présent (validation depuis PDF)
|
||||
if ($step->validationDialogUri()->isNotEmpty()) {
|
||||
$notification['dialogUri'] = $step->validationDialogUri()->value();
|
||||
}
|
||||
|
||||
$notifications[] = $notification;
|
||||
}
|
||||
|
||||
return $notifications;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue