From 85537d3465e864bff49d33caa6689372fc23b1ad Mon Sep 17 00:00:00 2001 From: isUnknown Date: Mon, 28 Oct 2024 15:55:14 +0100 Subject: [PATCH] notifications seems to work but new comments erase previous ones --- ...-bureaux-artistiquement-consideree.pdf.txt | 126 +----------------- public/site/config/routes/add-comment.php | 8 +- public/site/config/routes/logout.php | 2 +- public/site/controllers/site.php | 8 +- src/components/Menu.vue | 2 +- 5 files changed, 16 insertions(+), 130 deletions(-) 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 8226ab1..8249d86 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 @@ -13,124 +13,10 @@ Template: document Comments: 1: - m2lyrs06: - text: nouveau commentaire + m2t543hr: + fileUuid: file://s0lNtRA0Z7ybTCWG + page: 1 + text: Un autre commentaire username: Adrien Payet - date: 2024-10-23T16:22:47+02:00 - id: m2lyrs06 - m2t206b6: - text: Nouveau com - username: Adrien Payet - date: 2024-10-28T14:27:41+01:00 - id: m2t206b6 - m2t20ei0: - text: Et ebcore - username: Adrien Payet - date: 2024-10-28T14:27:51+01:00 - id: m2t20ei0 - m2t213jw: - text: test2 - username: Adrien Payet - date: 2024-10-28T14:28:24+01:00 - id: m2t213jw - m2t21e5f: - text: autre - username: Adrien Payet - date: 2024-10-28T14:28:38+01:00 - id: m2t21e5f - m2t21h7k: - text: sfgd - username: Adrien Payet - date: 2024-10-28T14:28:42+01:00 - id: m2t21h7k - m2t2sgrk: - text: test3 - username: Adrien Payet - date: 2024-10-28T14:49:41+01:00 - id: m2t2sgrk - m2t2sn60: - text: test4 - username: Adrien Payet - date: 2024-10-28T14:49:49+01:00 - id: m2t2sn60 - m2t2ux6u: - text: test5 - username: Adrien Payet - date: 2024-10-28T14:51:35+01:00 - id: m2t2ux6u - m2t2v0ba: - text: test6 - username: Adrien Payet - date: 2024-10-28T14:51:39+01:00 - id: m2t2v0ba - m2t2wak4: - text: test8 - username: Adrien Payet - date: 2024-10-28T14:52:39+01:00 - id: m2t2wak4 - m2t2z30f: - text: jfhj - username: Adrien Payet - date: 2024-10-28T14:54:49+01:00 - id: m2t2z30f - m2t2ze81: - text: qsvfh - username: Adrien Payet - date: 2024-10-28T14:55:04+01:00 - id: m2t2ze81 - m2t30udw: - text: fdgjh - username: Adrien Payet - date: 2024-10-28T14:56:12+01:00 - id: m2t30udw - m2t31bxv: - text: testl - username: Adrien Payet - date: 2024-10-28T14:56:34+01:00 - id: m2t31bxv - m2t32i8i: - text: dlakeja - username: Adrien Payet - date: 2024-10-28T14:57:29+01:00 - id: m2t32i8i - m2t33dra: - text: hfdts - username: Adrien Payet - date: 2024-10-28T14:58:10+01:00 - id: m2t33dra - m2t34im4: - text: lkqs - username: Adrien Payet - date: 2024-10-28T14:59:03+01:00 - id: m2t34im4 - m2t359np: - text: lqsjd - username: Adrien Payet - date: 2024-10-28T14:59:38+01:00 - id: m2t359np - m2t362kx: - text: ;sjn - username: Adrien Payet - date: 2024-10-28T15:00:16+01:00 - id: m2t362kx - m2t36rex: - text: jfghy - username: Adrien Payet - date: 2024-10-28T15:00:48+01:00 - id: m2t36rex - m2t37dx2: - text: dkdjsfn - username: Adrien Payet - date: 2024-10-28T15:01:17+01:00 - id: m2t37dx2 -2: - m2lys1bs: - text: test - username: Adrien Payet - date: 2024-10-23T16:22:59+02:00 - id: m2lys1bs - m2lys8xu: - text: 2e com page 2 - username: Adrien Payet - date: 2024-10-23T16:23:09+02:00 - id: m2lys8xu \ No newline at end of file + date: 2024-10-28T15:54:43+01:00 + id: m2t543hr \ No newline at end of file diff --git a/public/site/config/routes/add-comment.php b/public/site/config/routes/add-comment.php index 0a1eb01..e1fa1b8 100644 --- a/public/site/config/routes/add-comment.php +++ b/public/site/config/routes/add-comment.php @@ -7,20 +7,20 @@ return [ $json = file_get_contents('php://input'); $data = json_decode($json); - // return json_encode($data->pageUri); - $page = page($data->pageUri); $file = $page->file($data->fileName); $user = kirby()->user($data->userUuid); - $comments = $file->comments()->isEmpty() == true ? [] : Data::decode($file->comments()->toArray()['comments'], 'yaml'); + $comments = $file->comments()->isEmpty() == true ? [] : []; $newComment = [ + 'fileUuid' => (string )$file->uuid(), + 'page' => $data->targetPage, 'text' => $data->text, 'username' => $user->name()->isNotEmpty() ? (string) $user->name() : (string) $user->email(), 'date' => (string) $data->date, - 'id' => $data->id + 'id' => $data->id, ]; $comments[$data->targetPage][$data->id] = $newComment; diff --git a/public/site/config/routes/logout.php b/public/site/config/routes/logout.php index ff9d5b6..258c276 100644 --- a/public/site/config/routes/logout.php +++ b/public/site/config/routes/logout.php @@ -1,7 +1,7 @@ '(:all)logout.php', + 'pattern' => '(:all)logout', 'action' => function () { $kirby = kirby(); $user = $kirby->user(); diff --git a/public/site/controllers/site.php b/public/site/controllers/site.php index ac73d43..07de5ec 100644 --- a/public/site/controllers/site.php +++ b/public/site/controllers/site.php @@ -5,15 +5,15 @@ return function ($page, $kirby) { $data['template'] = (string) $page->template(); $userData = [ - "role" => $kirby->user()->role(), - "uuid" => $kirby->user()->uuid(), + "role" => (string) $kirby->user()->role(), + "uuid" => (string) $kirby->user()->uuid(), "notifications" => Yaml::decode($kirby->user()->notifications()->value()), ]; if ($kirby->user()->role() == 'client') { $userData['client'] = [ - "name" => $kirby->user()->client()->toPage()->title(), - "uuid" => $kirby->user()->client()->toPage()->uuid() + "name" => (string) $kirby->user()->client()->toPage()->title(), + "uuid" => (string) $kirby->user()->client()->toPage()->uuid() ]; } diff --git a/src/components/Menu.vue b/src/components/Menu.vue index d253666..d88d501 100644 --- a/src/components/Menu.vue +++ b/src/components/Menu.vue @@ -75,7 +75,7 @@ Profil
  • - Déconnexion + Déconnexion