Partially revert "Improve search for user in Modration module"

This reverts commit 78444ff25c.
↪️ When the uid parameter isn't set, the regular list should be shown instead of throwing an error.
This commit is contained in:
Hypolite Petovan 2025-01-22 21:36:32 -05:00
parent d97b8f8faa
commit 3e465cb761
3 changed files with 18 additions and 27 deletions

View file

@ -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) {

View file

@ -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) {

View file

@ -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) {