notifications seems to work but new comments erase previous ones
This commit is contained in:
parent
44361e614d
commit
85537d3465
5 changed files with 16 additions and 130 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
'pattern' => '(:all)logout.php',
|
||||
'pattern' => '(:all)logout',
|
||||
'action' => function () {
|
||||
$kirby = kirby();
|
||||
$user = $kirby->user();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue