fix Reply php class
This commit is contained in:
parent
f5ffe312e2
commit
14f409abec
3 changed files with 14 additions and 144 deletions
|
|
@ -6,129 +6,4 @@ Uuid: s0lNtRA0Z7ybTCWG
|
||||||
|
|
||||||
----
|
----
|
||||||
|
|
||||||
Template: document
|
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
|
|
||||||
|
|
@ -40,7 +40,7 @@ return [
|
||||||
'comments' => $comments
|
'comments' => $comments
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$user->sendNotification('comments', $newComment);
|
$user->sendNotification('comments', $newComment->toArray());
|
||||||
|
|
||||||
return getFileData($newFile);
|
return getFileData($newFile);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use adrienpayet\comments\Reply;
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'pattern' => '(:all)reply-comment.json',
|
'pattern' => '(:all)reply-comment.json',
|
||||||
'method' => 'POST',
|
'method' => 'POST',
|
||||||
|
|
@ -14,34 +16,27 @@ return [
|
||||||
|
|
||||||
$comments = $file->comments()->isEmpty() == true ? [] : Yaml::decode($file->comments()->value());
|
$comments = $file->comments()->isEmpty() == true ? [] : Yaml::decode($file->comments()->value());
|
||||||
|
|
||||||
$newComment = [
|
$data = [
|
||||||
'page' => [
|
'page' => $page,
|
||||||
'uri' => (string) $page->parent()->uri(),
|
'parentId' => $data->parentId,
|
||||||
'title' => (string) $page->parent()->title(),
|
'file' => $file,
|
||||||
],
|
'filePageIndex' => $data->filePageIndex,
|
||||||
'file' => [
|
|
||||||
'uuid' => (string) $file->uuid(),
|
|
||||||
'pageIndex' => $data->filePageIndex,
|
|
||||||
],
|
|
||||||
'text' => $data->text,
|
'text' => $data->text,
|
||||||
'user' => [
|
'user' => $user,
|
||||||
'name' => (string) $user->name(),
|
|
||||||
'email' => (string) $user->email(),
|
|
||||||
'uuid' => (string) $user->uuid(),
|
|
||||||
'role' => (string) $user->role()
|
|
||||||
],
|
|
||||||
'date' => (string) $data->date,
|
'date' => (string) $data->date,
|
||||||
'id' => $data->id,
|
'id' => $data->id,
|
||||||
'type' => 'comment'
|
'type' => 'comment'
|
||||||
];
|
];
|
||||||
|
|
||||||
$comments[$data->parentId]['replies'][$data->id] = $newComment;
|
$newReply = new Reply($data);
|
||||||
|
|
||||||
|
$comments[$newReply->parentId()]['replies'][$newReply->id()] = $newReply->toArray();
|
||||||
|
|
||||||
$newFile = $file->update([
|
$newFile = $file->update([
|
||||||
'comments' => $comments
|
'comments' => $comments
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$user->sendNotification('comments', $newComment);
|
$user->sendNotification('comments', $newReply->toArray());
|
||||||
|
|
||||||
return getFileData($newFile);
|
return getFileData($newFile);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue