Differential D15318 Diff 36947 src/infrastructure/daemon/bot/handler/PhabricatorBotObjectNameHandler.php
Changeset View
Changeset View
Standalone View
Standalone View
src/infrastructure/daemon/bot/handler/PhabricatorBotObjectNameHandler.php
Context not available. | |||||
*/ | */ | ||||
private $recentlyMentioned = array(); | private $recentlyMentioned = array(); | ||||
/** | |||||
* Checks if the message sender should be shown. The senders ignore list | |||||
* is stored in the bot configuration, at ignores.objects key. | |||||
* | |||||
* @param PhabricatorBotMessage The message sent to the bot | |||||
* @return bool | |||||
*/ | |||||
private function shouldShowLink(PhabricatorBotMessage $message) { | |||||
$ignores = $this->getConfig('ignores.objects', []); | |||||
$sender = $message->getSender(); | |||||
if ($sender !== null && in_array($sender->getName(), $ignores)) { | |||||
return false; | |||||
} | |||||
return true; | |||||
} | |||||
public function receiveMessage(PhabricatorBotMessage $original_message) { | public function receiveMessage(PhabricatorBotMessage $original_message) { | ||||
switch ($original_message->getCommand()) { | switch ($original_message->getCommand()) { | ||||
case 'MESSAGE': | case 'MESSAGE': | ||||
if (!$this->shouldShowLink($original_message)) { | |||||
return false; | |||||
} | |||||
$message = $original_message->getBody(); | $message = $original_message->getBody(); | ||||
$matches = null; | $matches = null; | ||||
Context not available. |