Fixing a bug in the bot ignore logic to use sender.
Summary: Also added sender to the campfire adapter. This isn't extremely useful as it's just a numeric id, but it allows us to add ignores (specifically having the bot ignore itself). Test Plan: Ran the bot, ignored itself. Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Differential Revision: https://secure.phabricator.com/D4893
This commit is contained in:
@@ -107,7 +107,7 @@ final class PhabricatorBot extends PhabricatorDaemon {
|
|||||||
|
|
||||||
private function routeMessage(PhabricatorBotMessage $message) {
|
private function routeMessage(PhabricatorBotMessage $message) {
|
||||||
$ignore = $this->getConfig('ignore');
|
$ignore = $this->getConfig('ignore');
|
||||||
if ($ignore && in_array($message->getSenderNickName(), $ignore)) {
|
if ($ignore && in_array($message->getSender(), $ignore)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -118,6 +118,7 @@ extends PhabricatorBaseProtocolAdapter {
|
|||||||
|
|
||||||
return id(new PhabricatorBotMessage())
|
return id(new PhabricatorBotMessage())
|
||||||
->setCommand('MESSAGE')
|
->setCommand('MESSAGE')
|
||||||
|
->setSender($m_obj['user_id'])
|
||||||
->setTarget($m_obj['room_id'])
|
->setTarget($m_obj['room_id'])
|
||||||
->setBody($m_obj['body']);
|
->setBody($m_obj['body']);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user