From 3e465cb76177c53389c2a01d9ac17ed301b00242 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Wed, 22 Jan 2025 21:36:32 -0500 Subject: [PATCH] Partially revert "Improve search for user in Modration module" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 78444ff25cfb0e30d79b78e4744a8b84aa06c52a. ↪️ When the uid parameter isn't set, the regular list should be shown instead of throwing an error. --- src/Module/Moderation/Users/Active.php | 15 ++++++--------- src/Module/Moderation/Users/Blocked.php | 15 ++++++--------- src/Module/Moderation/Users/Index.php | 15 ++++++--------- 3 files changed, 18 insertions(+), 27 deletions(-) diff --git a/src/Module/Moderation/Users/Active.php b/src/Module/Moderation/Users/Active.php index b16efa46ae..f25bb40ed2 100644 --- a/src/Module/Moderation/Users/Active.php +++ b/src/Module/Moderation/Users/Active.php @@ -51,15 +51,12 @@ class Active extends BaseUsers $action = (string) $this->parameters['action'] ?? ''; $uid = (int) $this->parameters['uid'] ?? 0; - if ($uid === 0) { - $this->systemMessages->addNotice($this->t('User not found')); - $this->baseUrl->redirect('moderation/users'); - } - - $user = User::getById($uid, ['username', 'blocked']); - if (!is_array($user)) { - $this->systemMessages->addNotice($this->t('User not found')); - $this->baseUrl->redirect('moderation/users'); + if ($uid !== 0) { + $user = User::getById($uid, ['username', 'blocked']); + if (!$user) { + $this->systemMessages->addNotice($this->t('User not found')); + $this->baseUrl->redirect('moderation/users'); + } } switch ($action) { diff --git a/src/Module/Moderation/Users/Blocked.php b/src/Module/Moderation/Users/Blocked.php index 6eeb11549f..6d4d1cce16 100644 --- a/src/Module/Moderation/Users/Blocked.php +++ b/src/Module/Moderation/Users/Blocked.php @@ -51,15 +51,12 @@ class Blocked extends BaseUsers $action = (string) $this->parameters['action'] ?? ''; $uid = (int) $this->parameters['uid'] ?? 0; - if ($uid === 0) { - $this->systemMessages->addNotice($this->t('User not found')); - $this->baseUrl->redirect('moderation/users'); - } - - $user = User::getById($uid, ['username', 'blocked']); - if (!is_array($user)) { - $this->systemMessages->addNotice($this->t('User not found')); - $this->baseUrl->redirect('moderation/users'); + if ($uid !== 0) { + $user = User::getById($uid, ['username', 'blocked']); + if (!$user) { + $this->systemMessages->addNotice($this->t('User not found')); + $this->baseUrl->redirect('moderation/users'); + } } switch ($action) { diff --git a/src/Module/Moderation/Users/Index.php b/src/Module/Moderation/Users/Index.php index 1a7d8f1721..61208d3403 100644 --- a/src/Module/Moderation/Users/Index.php +++ b/src/Module/Moderation/Users/Index.php @@ -58,15 +58,12 @@ class Index extends BaseUsers $action = (string) $this->parameters['action'] ?? ''; $uid = (int) $this->parameters['uid'] ?? 0; - if ($uid === 0) { - $this->systemMessages->addNotice($this->t('User not found')); - $this->baseUrl->redirect('moderation/users'); - } - - $user = User::getById($uid, ['username', 'blocked']); - if (!is_array($user)) { - $this->systemMessages->addNotice($this->t('User not found')); - $this->baseUrl->redirect('moderation/users'); + if ($uid !== 0) { + $user = User::getById($uid, ['username', 'blocked']); + if (!$user) { + $this->systemMessages->addNotice($this->t('User not found')); + $this->baseUrl->redirect('moderation/users'); + } } switch ($action) {