diff --git a/public/content/projects/1_miss-dior-blooming-bouquet/1_client-brief/38969543_extrait-de-louis-sullivan-form-follow-function.-de-la-tour-de-bureaux-artistiquement-consideree.pdf.txt b/public/content/projects/1_miss-dior-blooming-bouquet/1_client-brief/38969543_extrait-de-louis-sullivan-form-follow-function.-de-la-tour-de-bureaux-artistiquement-consideree.pdf.txt index 81aeac1..cb27a3c 100644 --- a/public/content/projects/1_miss-dior-blooming-bouquet/1_client-brief/38969543_extrait-de-louis-sullivan-form-follow-function.-de-la-tour-de-bureaux-artistiquement-consideree.pdf.txt +++ b/public/content/projects/1_miss-dior-blooming-bouquet/1_client-brief/38969543_extrait-de-louis-sullivan-form-follow-function.-de-la-tour-de-bureaux-artistiquement-consideree.pdf.txt @@ -6,129 +6,4 @@ Uuid: s0lNtRA0Z7ybTCWG ---- -Template: document - ----- - -Comments: - -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: - m2vmx97a: - page: - uri: projects/miss-dior-blooming-bouquet - title: Miss Dior Blooming Bouquet - file: - uuid: file://s0lNtRA0Z7ybTCWG - pageIndex: 1 - text: Test de réponse - user: - name: Adrien Payet - email: adrien.payet@outlook.com - uuid: user://WWjXgPWk - role: admin - date: 2024-10-30T09:48:49+01:00 - id: m2vmx97a - type: comment - 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-29T17:24:08+01:00 - id: m2unqxu0 - type: comment -m2unytm0: - page: - uri: projects/miss-dior-blooming-bouquet - title: Miss Dior Blooming Bouquet - file: - uuid: file://s0lNtRA0Z7ybTCWG - pageIndex: 1 - position: - x: null - y: null - replies: - m2unz4j1: - page: - uri: projects/miss-dior-blooming-bouquet - title: Miss Dior Blooming Bouquet - file: - uuid: file://s0lNtRA0Z7ybTCWG - pageIndex: 1 - text: Réponse à un commentaire - user: - name: Utilisateur Dior - email: utilisateur@dior.com - uuid: user://HfuumN8s - role: client - date: 2024-10-29T17:30:30+01:00 - id: m2unz4j1 - type: comment - text: Un autre commentaire - user: - name: Utilisateur Dior - email: utilisateur@dior.com - uuid: user://HfuumN8s - role: client - date: 2024-10-29T17:30:15+01:00 - id: m2unytm0 - type: comment -m2vmw7ct: - page: - uri: > - projects/miss-dior-blooming-bouquet/client-brief - title: Brief client - file: - uuid: file://s0lNtRA0Z7ybTCWG - pageIndex: 1 - replies: [ ] - text: > - encore un test après créaton classes - php comment - user: - name: Adrien Payet - email: adrien.payet@outlook.com - uuid: user://WWjXgPWk - role: admin - date: 2024-10-30T09:48:00+01:00 - id: m2vmw7ct - type: comment - position: - x: null - y: null -m2vmwvmt: - page: - uri: > - projects/miss-dior-blooming-bouquet/client-brief - title: Brief client - file: - uuid: file://s0lNtRA0Z7ybTCWG - pageIndex: 1 - replies: [ ] - text: > - encore un test après créaton classes - php comment - user: - name: Adrien Payet - email: adrien.payet@outlook.com - uuid: user://WWjXgPWk - role: admin - date: 2024-10-30T09:48:31+01:00 - id: m2vmwvmt - type: comment - position: - x: null - y: null \ No newline at end of file +Template: document \ No newline at end of file diff --git a/public/site/plugins/comments/routes/create.php b/public/site/plugins/comments/routes/create.php index 4449822..6059ca9 100644 --- a/public/site/plugins/comments/routes/create.php +++ b/public/site/plugins/comments/routes/create.php @@ -40,7 +40,7 @@ return [ 'comments' => $comments ]); - $user->sendNotification('comments', $newComment); + $user->sendNotification('comments', $newComment->toArray()); return getFileData($newFile); } diff --git a/public/site/plugins/comments/routes/reply.php b/public/site/plugins/comments/routes/reply.php index d142126..dd527b9 100644 --- a/public/site/plugins/comments/routes/reply.php +++ b/public/site/plugins/comments/routes/reply.php @@ -1,5 +1,7 @@ '(:all)reply-comment.json', 'method' => 'POST', @@ -14,34 +16,27 @@ return [ $comments = $file->comments()->isEmpty() == true ? [] : Yaml::decode($file->comments()->value()); - $newComment = [ - 'page' => [ - 'uri' => (string) $page->parent()->uri(), - 'title' => (string) $page->parent()->title(), - ], - 'file' => [ - 'uuid' => (string) $file->uuid(), - 'pageIndex' => $data->filePageIndex, - ], + $data = [ + 'page' => $page, + 'parentId' => $data->parentId, + 'file' => $file, + 'filePageIndex' => $data->filePageIndex, 'text' => $data->text, - 'user' => [ - 'name' => (string) $user->name(), - 'email' => (string) $user->email(), - 'uuid' => (string) $user->uuid(), - 'role' => (string) $user->role() - ], + 'user' => $user, 'date' => (string) $data->date, 'id' => $data->id, 'type' => 'comment' ]; - $comments[$data->parentId]['replies'][$data->id] = $newComment; + $newReply = new Reply($data); + + $comments[$newReply->parentId()]['replies'][$newReply->id()] = $newReply->toArray(); $newFile = $file->update([ 'comments' => $comments ]); - $user->sendNotification('comments', $newComment); + $user->sendNotification('comments', $newReply->toArray()); return getFileData($newFile); }