diff --git a/public/site/plugins/comments/routes/delete.php b/public/site/plugins/comments/routes/delete.php index b7b0895..f9dae6e 100644 --- a/public/site/plugins/comments/routes/delete.php +++ b/public/site/plugins/comments/routes/delete.php @@ -10,13 +10,13 @@ return [ $page = page($data->location->page->uri); $project = page($data->location->project->uri); $file = $page->file($data->location->file->uuid); - $isReply = $data->location->parentId ?? false; + $isReply = $data->location->parent->id ?? false; $comments = $file->comments()->isEmpty() == true ? [] : Yaml::decode($file->comments()->value()); foreach ($comments as $key => &$comment) { if ($isReply) { - if ($comment['id'] === $data->location->parentId) { + if ($comment['id'] === $data->location->parent->id) { foreach ($comment['replies'] as $replyKey => $reply) { if ($reply['id'] === $data->id) { unset($comment['replies'][$replyKey]); diff --git a/public/site/plugins/comments/routes/update.php b/public/site/plugins/comments/routes/update.php index ca875d4..4622ff2 100644 --- a/public/site/plugins/comments/routes/update.php +++ b/public/site/plugins/comments/routes/update.php @@ -10,13 +10,13 @@ return [ $page = page($data->location->page->uri); $project = page($data->location->project->uri); $file = $page->file($data->location->file->uuid); - $isReply = $data->location->parentId ?? false; + $isReply = $data->location->parent->id ?? false; $comments = $file->comments()->isEmpty() == true ? [] : Yaml::decode($file->comments()->value()); foreach ($comments as $key => &$comment) { if ($isReply) { - if ($comment['id'] === $data->location->parentId) { + if ($comment['id'] === $data->location->parent->id) { foreach ($comment['replies'] as $replyKey => $reply) { if ($reply['id'] === $data->id) { $comment['replies'][$replyKey]["text"] = $data->text; diff --git a/src/components/comments/Comment.vue b/src/components/comments/Comment.vue index 6b83e23..9e7fc57 100644 --- a/src/components/comments/Comment.vue +++ b/src/components/comments/Comment.vue @@ -141,7 +141,7 @@ async function deleteComment(event) { // If there is an active track, // it's not the opened file that should be updated // but the corresponding file in the active track - if (activeTracks.value.length > 0) { + if (activeTracks.value?.length > 0) { activeTracks.value[0].files = activeTracks.value[0].files.map((file) => { if (file.uuid !== newFile.uuid) return file; return newFile; diff --git a/src/components/comments/Comments.vue b/src/components/comments/Comments.vue index 4af34b1..ac33402 100644 --- a/src/components/comments/Comments.vue +++ b/src/components/comments/Comments.vue @@ -308,7 +308,7 @@ function openComment(comment) { openedComment.value = comment; - if (activeTracks?.value.length === 1) { + if (activeTracks.value?.length === 1) { openedFile.value = activeTracks.value[0].files.find( (file) => file.uuid === openedComment.value.location.file.uuid );