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 803203f..d962415 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 @@ -12,23 +12,43 @@ Template: document Comments: -m2vpa4tb: +- page: - uri: > - projects/miss-dior-blooming-bouquet/client-brief - title: Brief client + uri: projects/miss-dior-blooming-bouquet + title: Miss Dior Blooming Bouquet file: uuid: file://s0lNtRA0Z7ybTCWG pageIndex: 1 replies: [ ] - text: test - user: + text: Premier commentaire + author: name: Utilisateur Dior email: utilisateur@dior.com uuid: user://HfuumN8s role: client - date: 2024-10-30T10:54:49+01:00 - id: m2vpa4tb + date: 2024-10-30T12:08:36+01:00 + id: m2vrx0ls + type: comment + isRead: false + position: + x: null + y: null +- + page: + uri: projects/miss-dior-blooming-bouquet + title: Miss Dior Blooming Bouquet + file: + uuid: file://s0lNtRA0Z7ybTCWG + pageIndex: 1 + replies: [ ] + text: Deuxième commentaire + author: + name: Utilisateur Dior + email: utilisateur@dior.com + uuid: user://HfuumN8s + role: client + date: 2024-10-30T12:08:41+01:00 + id: m2vrx4zz type: comment isRead: false position: diff --git a/public/site/plugins/comments/routes/create.php b/public/site/plugins/comments/routes/create.php index 4449822..a3d2315 100644 --- a/public/site/plugins/comments/routes/create.php +++ b/public/site/plugins/comments/routes/create.php @@ -26,7 +26,7 @@ return [ ], 'replies' => [], 'text' => $data->text, - 'user' => $user, + 'author' => $user, 'date' => (string) $data->date, 'id' => $data->id, 'type' => 'comment' @@ -34,13 +34,13 @@ return [ $newComment = new Comment($data); - $comments[$newComment->id()] = $newComment->toArray(); + $comments[] = $newComment->toArray(); $newFile = $file->update([ 'comments' => $comments ]); - $user->sendNotification('comments', $newComment); + $user->sendNotification($newComment); return getFileData($newFile); } diff --git a/public/site/plugins/comments/src/BaseComment.php b/public/site/plugins/comments/src/BaseComment.php index b59317f..446f4c1 100644 --- a/public/site/plugins/comments/src/BaseComment.php +++ b/public/site/plugins/comments/src/BaseComment.php @@ -9,7 +9,7 @@ class BaseComment { protected $position; protected $replies; protected $text; - protected $user; + protected $author; protected $date; protected $id; protected $type; @@ -21,7 +21,7 @@ class BaseComment { $filePageIndex = $data['filePageIndex']; $replies = $data['replies'] ?? []; $text = $data['text']; - $user = $data['user']; + $author = $data['author']; $date = $data['date']; $id = $data['id']; $type = $data['type'] ?? 'comment'; @@ -36,11 +36,11 @@ class BaseComment { ]; $this->replies = $replies ?? []; $this->text = $text; - $this->user = [ - 'name' => (string) $user->name(), - 'email' => (string) $user->email(), - 'uuid' => (string) $user->uuid(), - 'role' => (string) $user->role(), + $this->author = [ + 'name' => (string) $author->name(), + 'email' => (string) $author->email(), + 'uuid' => (string) $author->uuid(), + 'role' => (string) $author->role(), ]; $this->date = $date; $this->id = $id; @@ -64,8 +64,8 @@ class BaseComment { return $this->text; } - public function user() { - return $this->user; + public function author() { + return $this->author; } public function date() { @@ -100,7 +100,7 @@ class BaseComment { 'file' => $this->file, 'replies' => $this->replies, 'text' => $this->text, - 'user' => $this->user, + 'author' => $this->author, 'date' => $this->date, 'id' => $this->id, 'type' => $this->type, diff --git a/public/site/plugins/notifications/user-methods/send.php b/public/site/plugins/notifications/user-methods/send.php index d10eb31..63b9ee2 100644 --- a/public/site/plugins/notifications/user-methods/send.php +++ b/public/site/plugins/notifications/user-methods/send.php @@ -1,17 +1,13 @@ users()->not($this) as $otherUser) { try { $notifications = $otherUser->notifications()->isNotEmpty() ? Yaml::decode($otherUser->notifications()->value()) : []; - - if (!isset($notifications[$group])) { - $notifications[$group] = []; - } - $notifications[$group][$item->id()] = $item->toArray(); + $notifications[] = $item->toArray(); $otherUser->update([ 'notifications' => $notifications diff --git a/src/components/comments/Comment.vue b/src/components/comments/Comment.vue index 22072cf..f5d66c8 100644 --- a/src/components/comments/Comment.vue +++ b/src/components/comments/Comment.vue @@ -2,7 +2,7 @@

- {{ comment.user.name ?? comment.user.email }} + {{ comment.author.name ?? comment.author.email }}