dynamize notifications view

This commit is contained in:
isUnknown 2024-10-29 17:26:23 +01:00
parent 8ed7331b61
commit c099e0d5ac
6 changed files with 127 additions and 132 deletions

View file

@ -12,93 +12,25 @@ Template: document
Comments:
m2ucagze:
pageUri: >
projects/miss-dior-blooming-bouquet/client-brief
fileUuid: file://s0lNtRA0Z7ybTCWG
filePageIndex: 1
position:
x: null
y: null
replies:
m2umbiak:
pageUri: >
projects/miss-dior-blooming-bouquet/client-brief
fileUuid: file://s0lNtRA0Z7ybTCWG
filePageIndex: 1
text: réponse
user:
name: Adrien Payet
email: adrien.payet@outlook.com
uuid: user://WWjXgPWk
role: admin
date: 2024-10-29T16:44:08+01:00
id: m2umbiak
m2umh277:
pageUri: >
projects/miss-dior-blooming-bouquet/client-brief
fileUuid: file://s0lNtRA0Z7ybTCWG
filePageIndex: 1
text: deuxième réponse
user:
name: Adrien Payet
email: adrien.payet@outlook.com
uuid: user://WWjXgPWk
role: admin
date: 2024-10-29T16:48:27+01:00
id: m2umh277
m2umjmbx:
pageUri: >
projects/miss-dior-blooming-bouquet/client-brief
fileUuid: file://s0lNtRA0Z7ybTCWG
filePageIndex: 1
text: troisième commentaire
user:
name: Adrien Payet
email: adrien.payet@outlook.com
uuid: user://WWjXgPWk
role: admin
date: 2024-10-29T16:50:27+01:00
id: m2umjmbx
text: com1
user:
name: Adrien Payet
email: adrien.payet@outlook.com
uuid: user://WWjXgPWk
role: admin
date: 2024-10-29T12:03:24+01:00
id: m2ucagze
m2ucgaoe:
pageUri: >
projects/miss-dior-blooming-bouquet/client-brief
fileUuid: file://s0lNtRA0Z7ybTCWG
filePageIndex: 1
m2unqxu0:
page:
uri: projects/miss-dior-blooming-bouquet
title: Miss Dior Blooming Bouquet
file:
uuid: file://s0lNtRA0Z7ybTCWG
pageIndex: 1
position:
x: null
y: null
replies: [ ]
text: Deuxième commentaire
text: >
Un commentaire écrit par Adrien pour
tester.
user:
name: Adrien Payet
email: adrien.payet@outlook.com
uuid: user://WWjXgPWk
role: admin
date: 2024-10-29T12:07:55+01:00
id: m2ucgaoe
m2uchjp9:
pageUri: >
projects/miss-dior-blooming-bouquet/client-brief
fileUuid: file://s0lNtRA0Z7ybTCWG
filePageIndex: 2
position:
x: null
y: null
replies: [ ]
text: Troisième commentaire sur page 2
user:
name: Adrien Payet
email: adrien.payet@outlook.com
uuid: user://WWjXgPWk
role: admin
date: 2024-10-29T12:08:54+01:00
id: m2uchjp9
date: 2024-10-29T17:24:08+01:00
id: m2unqxu0
type: comment

View file

@ -15,9 +15,14 @@ return [
$comments = $file->comments()->isEmpty() == true ? [] : Yaml::decode($file->comments()->value());
$newComment = [
'pageUri' => $data->pageUri,
'fileUuid' => (string) $file->uuid(),
'filePageIndex' => $data->filePageIndex,
'page' => [
'uri' => (string) $page->parent()->uri(),
'title' => (string) $page->parent()->title(),
],
'file' => [
'uuid' => (string) $file->uuid(),
'pageIndex' => $data->filePageIndex,
],
'position' => [
'x' => null,
'y' => null
@ -32,6 +37,7 @@ return [
],
'date' => (string) $data->date,
'id' => $data->id,
'type' => 'comment'
];
$comments[$data->id] = $newComment;
@ -40,7 +46,7 @@ return [
'comments' => $comments
]);
// $user->sendNotification('comments', $newComment);
$user->sendNotification('comments', $newComment);
return getFileData($newFile);
}

View file

@ -15,9 +15,14 @@ return [
$comments = $file->comments()->isEmpty() == true ? [] : Yaml::decode($file->comments()->value());
$newComment = [
'pageUri' => $data->pageUri,
'fileUuid' => (string) $file->uuid(),
'filePageIndex' => $data->filePageIndex,
'page' => [
'uri' => (string) $page->parent()->uri(),
'title' => (string) $page->parent()->title(),
],
'file' => [
'uuid' => (string) $file->uuid(),
'pageIndex' => $data->filePageIndex,
],
'text' => $data->text,
'user' => [
'name' => (string) $user->name(),
@ -27,6 +32,7 @@ return [
],
'date' => (string) $data->date,
'id' => $data->id,
'type' => 'comment'
];
$comments[$data->parentId]['replies'][$data->id] = $newComment;