delete reply working
This commit is contained in:
parent
6cc8325d2b
commit
dd6eff2904
4 changed files with 6 additions and 6 deletions
|
|
@ -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]);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue