mirror of
https://github.com/wbbaddons/Tims-Chat.git
synced 2024-10-31 14:10:08 +00:00
Use UserInputException instead of Information message
This commit is contained in:
parent
0b5ff9d390
commit
87c7fdd03d
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user