reply comment on 360 working

This commit is contained in:
isUnknown 2024-12-20 12:36:21 +01:00
parent d727f1a1af
commit f790653fcf
8 changed files with 38 additions and 18 deletions

View file

@ -9,19 +9,11 @@ return [
$json = file_get_contents('php://input');
$data = json_decode($json);
$parsedUrl = parse_url($data->dialogUri);
$query = $parsedUrl['query'] ?? null;
parse_str($query, $queryParams);
$stepSlug = $queryParams['dialog'] ?? null;
$targetPageUri = $stepSlug ? $parsedUrl['path'] . '/' . $stepSlug : $parsedUrl['path'];
$project = page($parsedUrl['path']);
$page = page($targetPageUri);
$page = page($data->fileParentUri);
$project = $page->parent()->template() == "project" ? $page->parent() : $page->parent()->parent();
$file = $page->file($data->fileName);
$user = kirby()->user($data->userUuid);
$comments = $file->comments()->isEmpty() == true ? [] : Yaml::decode($file->comments()->value());
foreach ($comments as &$comment) {
@ -36,7 +28,7 @@ return [
"parent" => $comment
],
"position" => [
"pageIndex" => $data->position->pageIndex,
"pageIndex" => $data->position->pageIndex ?? null,
],
"date" => (string) $data->date,
"text" => $data->text,

View file

@ -11,7 +11,7 @@ class BaseComment {
protected string $text;
protected string $date;
protected string $id;
protected Position $position;
protected ?Position $position = null;
public function __construct($data) {
$this->location = new Location($data["location"]);