diff --git a/Web/Presenters/WallPresenter.php b/Web/Presenters/WallPresenter.php index 73101d1b..d9ba06b0 100644 --- a/Web/Presenters/WallPresenter.php +++ b/Web/Presenters/WallPresenter.php @@ -363,51 +363,50 @@ final class WallPresenter extends OpenVKPresenter $this->assertNoCSRF(); $post = $this->posts->getPostById($wall, $post_id); - if(!$post || $post->isDeleted()) $this->notFound(); + + if(!$post || $post->isDeleted()) + $this->notFound(); + $where = $this->postParam("type") ?? "wall"; $groupId = NULL; $flags = 0; + if($where == "group") - { $groupId = $this->postParam("groupId"); - } + if(!is_null($this->user)) { $nPost = new Post; - if($where == "wall") - { + + if($where == "wall") { $nPost->setOwner($this->user->id); $nPost->setWall($this->user->id); - } - elseif($where == "group") - { + } elseif($where == "group") { $nPost->setOwner($this->user->id); - if($this->postParam("asGroup") == 1) - { + if($this->postParam("asGroup") == 1) $flags |= 0b10000000; - } + if($this->postParam("signed") == 1) - { $flags |= 0b01000000; - } + $nPost->setWall($groupId*-1); } + $nPost->setContent($this->postParam("text")); $nPost->setFlags($flags); $nPost->save(); + $nPost->attach($post); if($post->getOwner(false)->getId() !== $this->user->identity->getId() && !($post->getOwner() instanceof Club)) (new RepostNotification($post->getOwner(false), $post, $this->user->identity))->emit(); }; + if($where == "wall") - { $this->returnJson(["wall_owner" => $this->user->identity->getId()]); - } + else - { $this->returnJson(["wall_owner" => $groupId*-1]); - } } function renderDelete(int $wall, int $post_id): void