From 4e4216f8d35235029f95d0c4bf11f6e6e811161e Mon Sep 17 00:00:00 2001 From: isUnknown Date: Tue, 29 Oct 2024 16:13:07 +0100 Subject: [PATCH] merge and add opened comment view --- ...-bureaux-artistiquement-consideree.pdf.txt | 18 +- .../site/plugins/comments/routes/create.php | 4 +- .../notifications/user-methods/read.php | 16 ++ .../notifications/user-methods/send.php | 26 +++ src/components/comments/Comment.vue | 78 +++++++++ src/components/comments/Comments.vue | 156 ++++-------------- 6 files changed, 164 insertions(+), 134 deletions(-) create mode 100644 public/site/plugins/notifications/user-methods/read.php create mode 100644 public/site/plugins/notifications/user-methods/send.php create mode 100644 src/components/comments/Comment.vue 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 d3f57a4..788f452 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,11 +12,11 @@ Template: document Comments: -m2u905al: +m2ucagze: pageUri: > projects/miss-dior-blooming-bouquet/client-brief fileUuid: file://s0lNtRA0Z7ybTCWG - filePageTarget: 1 + filePageIndex: 1 position: x: null y: null @@ -27,22 +27,22 @@ m2u905al: email: adrien.payet@outlook.com uuid: user://WWjXgPWk role: admin - date: 2024-10-29T10:31:23+01:00 - id: m2u905al -m2u955a7: + date: 2024-10-29T12:03:24+01:00 + id: m2ucagze +m2ucgaoe: pageUri: > projects/miss-dior-blooming-bouquet/client-brief fileUuid: file://s0lNtRA0Z7ybTCWG - filePageTarget: 1 + filePageIndex: 1 position: x: null y: null replies: [ ] - text: come2 + text: Deuxième commentaire user: name: Adrien Payet email: adrien.payet@outlook.com uuid: user://WWjXgPWk role: admin - date: 2024-10-29T10:35:16+01:00 - id: m2u955a7 \ No newline at end of file + date: 2024-10-29T12:07:55+01:00 + id: m2ucgaoe \ 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 282fbe7..4bc0791 100644 --- a/public/site/plugins/comments/routes/create.php +++ b/public/site/plugins/comments/routes/create.php @@ -17,7 +17,7 @@ return [ $newComment = [ 'pageUri' => $data->pageUri, 'fileUuid' => (string) $file->uuid(), - 'filePageTarget' => $data->targetPage, + 'filePageIndex' => $data->filePageIndex, 'position' => [ 'x' => null, 'y' => null @@ -40,7 +40,7 @@ return [ 'comments' => $comments ]); - $user->sendNotification('comments', $newComment); + // $user->sendNotification('comments', $newComment); return getFileData($newFile); } diff --git a/public/site/plugins/notifications/user-methods/read.php b/public/site/plugins/notifications/user-methods/read.php new file mode 100644 index 0000000..b039807 --- /dev/null +++ b/public/site/plugins/notifications/user-methods/read.php @@ -0,0 +1,16 @@ +notifications()->value()); + + try { + $notifications[$group][$notificationId]['isRead'] = true; + } catch (\Throwable $th) { + //throw $th; + } + + $this->update([ + "notifications" => $notifications + ]); + return $notifications; +}; \ No newline at end of file diff --git a/public/site/plugins/notifications/user-methods/send.php b/public/site/plugins/notifications/user-methods/send.php new file mode 100644 index 0000000..dbf9f04 --- /dev/null +++ b/public/site/plugins/notifications/user-methods/send.php @@ -0,0 +1,26 @@ +users()->not($this) as $otherUser) { + try { + $notifications = $otherUser->notifications()->isNotEmpty() + ? Yaml::decode($otherUser->notifications()->value()) + : []; + + if (!isset($notifications[$group])) { + $notifications[$group] = []; + } + + + $data['isRead'] = false; + + $notifications[$group][$data['id']] = $data; + + $otherUser->update([ + 'notifications' => $notifications + ]); + } catch (\Throwable $th) { + throw new Exception("Error updating notifications: " . $th->getMessage() . ' line ' . $th->getLine(), 1); + } + } +}; \ No newline at end of file diff --git a/src/components/comments/Comment.vue b/src/components/comments/Comment.vue new file mode 100644 index 0000000..1bb9be0 --- /dev/null +++ b/src/components/comments/Comment.vue @@ -0,0 +1,78 @@ + + + diff --git a/src/components/comments/Comments.vue b/src/components/comments/Comments.vue index e4a34b0..72fdf74 100644 --- a/src/components/comments/Comments.vue +++ b/src/components/comments/Comments.vue @@ -2,87 +2,38 @@