comments / notifications : improve abstraction

This commit is contained in:
isUnknown 2024-11-18 12:00:19 +01:00
parent f467012241
commit 32c026acfe
11 changed files with 92 additions and 65 deletions

View file

@ -7,8 +7,9 @@ return [
$json = file_get_contents('php://input');
$data = json_decode($json);
$page = page($data->page->uri);
$file = $page->file($data->file->uuid);
$page = page($data->location->page->uri);
$project = page($data->location->project->uri);
$file = $page->file($data->location->file->uuid);
$isReply = $data->parentId ?? false;
$comments = $file->comments()->isEmpty() == true ? [] : Yaml::decode($file->comments()->value());
@ -38,7 +39,7 @@ return [
echo json_encode(getFileData($newFile));
kirby()->user()->deleteNotification($page->managers()->toUsers(), $data->id);
kirby()->user()->deleteNotification($project->managers()->toUsers(), $data->id);
exit;
}