diff --git a/Web/Models/Entities/BlacklistItem.php b/Web/Models/Entities/BlacklistItem.php index fcc19452..cf147798 100644 --- a/Web/Models/Entities/BlacklistItem.php +++ b/Web/Models/Entities/BlacklistItem.php @@ -28,4 +28,6 @@ class BlacklistItem extends RowModel { return new DateTime($this->getRecord()->created); } + + } \ No newline at end of file diff --git a/Web/Models/Repositories/Blacklists.php b/Web/Models/Repositories/Blacklists.php index 66cce946..50fb9d70 100644 --- a/Web/Models/Repositories/Blacklists.php +++ b/Web/Models/Repositories/Blacklists.php @@ -24,7 +24,11 @@ class Blacklists function getByAuthorAndTarget(int $author, int $target): ?BlacklistItem { - return new BlacklistItem($this->blacklists->where(["author" => $author, "target" => $target])->fetch()); + $fetch = $this->blacklists->where(["author" => $author, "target" => $target])->fetch(); + if ($fetch) + return new BlacklistItem($fetch); + else + return null; } function getCount(User $user): int @@ -37,6 +41,9 @@ class Blacklists if (!$author || !$target) return FALSE; + bdump($this->getByAuthorAndTarget($author->getId(), $target->getId()), "хуита какая-то вроде для бл*клиста"); + + return !is_null($this->getByAuthorAndTarget($author->getId(), $target->getId())); } } diff --git a/Web/Presenters/UserPresenter.php b/Web/Presenters/UserPresenter.php index 4eca5038..3dd4c9d0 100644 --- a/Web/Presenters/UserPresenter.php +++ b/Web/Presenters/UserPresenter.php @@ -34,14 +34,14 @@ final class UserPresenter extends OpenVKPresenter if ($this->user->identity) if ($this->blacklists->isBanned($user, $this->user->identity)) { - if ($this->user->identity->isAdmin()) { - if (OPENVK_ROOT_CONF["openvk"]["preferences"]["security"]["blacklists"]["applyToAdmins"]) { - $this->flashFail("err", tr("forbidden"), tr("user_blacklisted_you")); - } - } else { + if ($this->user->identity->isAdmin()) { + if (OPENVK_ROOT_CONF["openvk"]["preferences"]["security"]["blacklists"]["applyToAdmins"]) { $this->flashFail("err", tr("forbidden"), tr("user_blacklisted_you")); } + } else { + $this->flashFail("err", tr("forbidden"), tr("user_blacklisted_you")); } + } if(!$user || $user->isDeleted()) { if(!is_null($user) && $user->isDeactivated()) { diff --git a/Web/Presenters/templates/User/View.xml b/Web/Presenters/templates/User/View.xml index 9ab1a1eb..295825cb 100644 --- a/Web/Presenters/templates/User/View.xml +++ b/Web/Presenters/templates/User/View.xml @@ -394,7 +394,7 @@