Исправил стиль кода в renderShare

This commit is contained in:
lalka2016 2023-05-08 14:50:26 +03:00
parent 07a1b33722
commit 231cd23eef

View file

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