content notification read working
This commit is contained in:
parent
ffb8252808
commit
94c5737245
21 changed files with 317 additions and 163 deletions
|
|
@ -24,28 +24,27 @@ return [
|
|||
|
||||
$comments = $file->comments()->isEmpty() == true ? [] : Yaml::decode($file->comments()->value());
|
||||
|
||||
$replyData = [
|
||||
"location" => [
|
||||
"page" => $page,
|
||||
"project" => $project,
|
||||
"dialogUri" => $data->dialogUri,
|
||||
"file" => $file,
|
||||
],
|
||||
"parentId" => $data->parentId,
|
||||
"position" => [
|
||||
"pageIndex" => $data->position->pageIndex,
|
||||
],
|
||||
"date" => (string) $data->date,
|
||||
"text" => $data->text,
|
||||
"author" => kirby()->user(),
|
||||
"id" => Str::uuid(),
|
||||
"type" => "comment",
|
||||
];
|
||||
|
||||
$newReply = new Reply($replyData);
|
||||
|
||||
foreach ($comments as &$comment) {
|
||||
if ($comment['id'] === $newReply->parentId()) {
|
||||
$isParentComment = $comment['id'] === $data->parentId;
|
||||
if ($isParentComment) {
|
||||
$replyData = [
|
||||
"location" => [
|
||||
"page" => $page,
|
||||
"project" => $project,
|
||||
"dialogUri" => $data->dialogUri,
|
||||
"file" => $file,
|
||||
"parent" => $comment
|
||||
],
|
||||
"position" => [
|
||||
"pageIndex" => $data->position->pageIndex,
|
||||
],
|
||||
"date" => (string) $data->date,
|
||||
"text" => $data->text,
|
||||
"author" => kirby()->user(),
|
||||
"id" => Str::uuid(),
|
||||
"type" => "comment-reply",
|
||||
];
|
||||
$newReply = new Reply($replyData);
|
||||
$comment['replies'][] = $newReply->toArray();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue