Groups: Fix posting comments on behalf of the group

This commit is contained in:
Maxim Leshchenko 2021-12-17 17:13:40 +02:00
parent 846510ef93
commit e65d6231a1
No known key found for this signature in database
GPG key ID: BB9C44A8733FBEEE

View file

@ -1,8 +1,8 @@
<?php declare(strict_types=1); <?php declare(strict_types=1);
namespace openvk\Web\Presenters; namespace openvk\Web\Presenters;
use openvk\Web\Models\Entities\{Comment, Photo, Video, User, Topic}; use openvk\Web\Models\Entities\{Comment, Photo, Video, User, Topic, Post};
use openvk\Web\Models\Entities\Notifications\CommentNotification; use openvk\Web\Models\Entities\Notifications\CommentNotification;
use openvk\Web\Models\Repositories\Comments; use openvk\Web\Models\Repositories\{Comments, Clubs};
final class CommentPresenter extends OpenVKPresenter final class CommentPresenter extends OpenVKPresenter
{ {
@ -42,7 +42,7 @@ final class CommentPresenter extends OpenVKPresenter
if($entity instanceof Topic && $entity->isClosed()) if($entity instanceof Topic && $entity->isClosed())
$this->notFound(); $this->notFound();
if($entity instanceof Post && $entity->getTargetWall() > 0) if($entity instanceof Post && $entity->getTargetWall() < 0)
$club = (new Clubs)->get(abs($entity->getTargetWall())); $club = (new Clubs)->get(abs($entity->getTargetWall()));
else if($entity instanceof Topic) else if($entity instanceof Topic)
$club = $entity->getClub(); $club = $entity->getClub();