diff --git a/file/lib/system/command/commands/BanCommand.class.php b/file/lib/system/command/commands/BanCommand.class.php index fb1ba09..220d16b 100644 --- a/file/lib/system/command/commands/BanCommand.class.php +++ b/file/lib/system/command/commands/BanCommand.class.php @@ -18,8 +18,7 @@ class BanCommand extends MuteCommand { public function executeAction() { if ($suspension = suspension\Suspension::getSuspensionByUserRoomAndType($this->user, $this->room, suspension\Suspension::TYPE_BAN)) { if ($suspension->time > TIME_NOW + $this->time) { - $this->fail = true; - return; + throw new \wcf\system\exception\UserInputException('text', WCF::getLanguage()->get('wcf.chat.suspension.exists')); } $editor = new suspension\SuspensionEditor($suspension); diff --git a/file/lib/system/command/commands/GbanCommand.class.php b/file/lib/system/command/commands/GbanCommand.class.php index 0754a7f..5b32483 100644 --- a/file/lib/system/command/commands/GbanCommand.class.php +++ b/file/lib/system/command/commands/GbanCommand.class.php @@ -20,8 +20,7 @@ public function executeAction() { if ($suspension = suspension\Suspension::getSuspensionByUserRoomAndType($this->user, $room, suspension\Suspension::TYPE_BAN)) { if ($suspension->time > TIME_NOW + $this->time) { - $this->fail = true; - return; + throw new \wcf\system\exception\UserInputException('text', WCF::getLanguage()->get('wcf.chat.suspension.exists')); } $editor = new suspension\SuspensionEditor($suspension); diff --git a/file/lib/system/command/commands/GmuteCommand.class.php b/file/lib/system/command/commands/GmuteCommand.class.php index d8fe988..b34467c 100644 --- a/file/lib/system/command/commands/GmuteCommand.class.php +++ b/file/lib/system/command/commands/GmuteCommand.class.php @@ -20,8 +20,7 @@ public function executeAction() { if ($suspension = suspension\Suspension::getSuspensionByUserRoomAndType($this->user, $room, suspension\Suspension::TYPE_MUTE)) { if ($suspension->time > TIME_NOW + $this->time) { - $this->fail = true; - return; + throw new \wcf\system\exception\UserInputException('text', WCF::getLanguage()->get('wcf.chat.suspension.exists')); } $editor = new suspension\SuspensionEditor($suspension); diff --git a/file/lib/system/command/commands/MuteCommand.class.php b/file/lib/system/command/commands/MuteCommand.class.php index 9a8cd11..7afecc5 100644 --- a/file/lib/system/command/commands/MuteCommand.class.php +++ b/file/lib/system/command/commands/MuteCommand.class.php @@ -19,7 +19,6 @@ class MuteCommand extends \chat\system\command\AbstractRestrictedCommand { public $time = 0; public $suspensionAction = null; public $link = ''; - public $fail = false; public $room = null; public function __construct(\chat\system\command\CommandHandler $commandHandler) { @@ -51,8 +50,7 @@ public function __construct(\chat\system\command\CommandHandler $commandHandler) public function executeAction() { if ($suspension = suspension\Suspension::getSuspensionByUserRoomAndType($this->user, $this->room, suspension\Suspension::TYPE_MUTE)) { if ($suspension->time > TIME_NOW + $this->time) { - $this->fail = true; - return; + throw new \wcf\system\exception\UserInputException('text', WCF::getLanguage()->get('wcf.chat.suspension.exists')); } $editor = new suspension\SuspensionEditor($suspension); @@ -85,8 +83,6 @@ public function checkPermission() { * @see chat\system\command\ICommand::getReceiver() */ public function getReceiver() { - if ($this->fail) return WCF::getUser()->userID; - return parent::getReceiver(); } @@ -94,7 +90,6 @@ public function getReceiver() { * @see \chat\system\command\ICommand::getType() */ public function getType() { - if ($this->fail) return \chat\data\message\Message::TYPE_INFORMATION; return \chat\data\message\Message::TYPE_MODERATE; } @@ -102,8 +97,6 @@ public function getType() { * @see \chat\system\command\ICommand::getMessage() */ public function getMessage() { - if ($this->fail) return WCF::getLanguage()->get('wcf.chat.suspension.exists'); - return serialize(array( 'link' => $this->link, 'until' => TIME_NOW + $this->time,