new content notification working for client brief

This commit is contained in:
isUnknown 2024-11-22 09:20:38 +01:00
parent 8ae00d7657
commit c1d2c73118
9 changed files with 277 additions and 70 deletions

View file

@ -33,7 +33,7 @@ return [
'y' => $data->position->y
],
'replies' => [],
'text' => $data->text,
'text' => $user->name()->isNotEmpty() ? $user->name()->value() . ' : ' . $data->text : $user->email()->value() . ' : ' . $data->text,
'author' => $user,
'date' => (string) $data->date,
'id' => $data->id,

View file

@ -9,7 +9,14 @@ return [
$json = file_get_contents('php://input');
$data = json_decode($json);
$page = page($data->pageUri);
$parsedUrl = parse_url($data->path);
$query = $parsedUrl['query'] ?? null;
parse_str($query, $queryParams);
$stepSlug = $queryParams['dialog'] ?? null;
$targetPageUri = $stepSlug ? $parsedUrl['path'] . '/' . $stepSlug : $parsedUrl['path'];
$page = page($targetPageUri);
$file = $page->file($data->fileName);
$user = kirby()->user($data->userUuid);
@ -17,6 +24,7 @@ return [
$comments = $file->comments()->isEmpty() == true ? [] : Yaml::decode($file->comments()->value());
$data = [
'href' => $data->path,
'page' => $page,
'parentId' => $data->parentId,
'file' => $file,