From 207ba891f56c78568148127288779cdeecb3de04 Mon Sep 17 00:00:00 2001 From: Visman Date: Tue, 30 May 2023 23:00:17 +0700 Subject: [PATCH] hange the order of conditions --- app/Models/User/User.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/Models/User/User.php b/app/Models/User/User.php index 03d2169c..bb34be63 100644 --- a/app/Models/User/User.php +++ b/app/Models/User/User.php @@ -81,8 +81,7 @@ class User extends DataModel */ protected function getisBanByName(): bool { - return ! $this->isAdmin - && $this->c->bans->banFromName($this->username) > 0; + return ! $this->isAdmin && $this->c->bans->banFromName($this->username) > 0; } /** @@ -96,6 +95,7 @@ class User extends DataModel while (! $model instanceof Forum) { $model = $model->parent; + if (! $model instanceof Model) { throw new RuntimeException('Moderator\'s rights can not be found'); } @@ -265,7 +265,7 @@ class User extends DataModel */ protected function getviewUsers(): bool { - return 1 === $this->g_view_users || $this->isAdmin; + return $this->isAdmin || 1 === $this->g_view_users; } /** @@ -273,7 +273,7 @@ class User extends DataModel */ protected function getsearchUsers(): bool { - return 1 === $this->g_search_users || $this->isAdmin; + return $this->isAdmin || 1 === $this->g_search_users; } /** @@ -400,7 +400,7 @@ class User extends DataModel */ protected function getusePoll(): bool { - return 1 === $this->c->config->b_poll_enabled && ! $this->isGuest; + return ! $this->isGuest && 1 === $this->c->config->b_poll_enabled; } public function fLog(): string