users / notifications : temporary disabled notifications system
This commit is contained in:
parent
9167519388
commit
ef6375f4cc
15 changed files with 302 additions and 113 deletions
32
public/site/config/routes/validate-brief.php
Normal file
32
public/site/config/routes/validate-brief.php
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
'pattern' => '(:all)validate-brief.json',
|
||||
'method' => 'POST',
|
||||
'action' => function () {
|
||||
$json = file_get_contents('php://input');
|
||||
$data = json_decode($json);
|
||||
|
||||
$page = page($data->pageUri);
|
||||
try {
|
||||
$newPage = $page->update([
|
||||
'isValidated' => 'true'
|
||||
]);
|
||||
echo json_encode([
|
||||
"success" => "'" . $newPage->title()->value() . "' brief validated."
|
||||
]);
|
||||
|
||||
kirby()->user()->sendNotification($newPage->parent(), [
|
||||
'date' => $newPage->modified('YYYY-MM-DD'),
|
||||
'author' => kirby()->user()->name()->isNotEmpty() ? kirby()->user()->name() : kirby()->user()->email(),
|
||||
'url' => $newPage->url(),
|
||||
'type' => 'content'
|
||||
]);
|
||||
} catch (\Throwable $th) {
|
||||
return [
|
||||
"error" => "Can't validate '" . $page->title()->value() . "' brief.",
|
||||
'details' => $th->getMessage()
|
||||
];
|
||||
}
|
||||
}
|
||||
];
|
||||
Loading…
Add table
Add a link
Reference in a new issue