1
0
mirror of https://github.com/wbbaddons/Tims-Chat.git synced 2024-10-31 14:10:08 +00:00

Disallow whispering of users that block one

Closes #61
This commit is contained in:
Tim Düsterhus 2013-10-06 17:27:08 +02:00
parent 7acf736510
commit d0d091547c

View File

@ -1,6 +1,6 @@
<?php
namespace chat\system\command\commands;
use \wcf\data\user\User;
use \wcf\data\user\UserProfile;
/**
* Whispers a message.
@ -29,8 +29,13 @@ public function __construct(\chat\system\command\CommandHandler $commandHandler)
throw new \InvalidArgumentException();
}
$this->user = User::getUserByUsername($username);
$this->user = UserProfile::getUserProfileByUsername($username);
if (!$this->user->userID) throw new \chat\system\command\UserNotFoundException($username);
if (!\wcf\system\WCF::getSession()->getPermission('user.profile.cannotBeIgnored')) {
if ($this->user->isIgnoredUser(\wcf\system\WCF::getUser()->userID)) {
throw new \wcf\system\exception\UserInputException('text', \wcf\system\WCF::getLanguage()->getDynamicVariable('chat.error.whisper.ignoresYou', array('user' => $this->user)));
}
}
$this->didInit();
}