From eaa72c6155e5e54bc9f3c3af9c9238583b0f28bf Mon Sep 17 00:00:00 2001 From: indiefan Date: Sat, 9 Feb 2013 16:10:16 -0800 Subject: [PATCH] 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 --- src/infrastructure/daemon/bot/PhabricatorBot.php | 2 +- .../daemon/bot/adapter/PhabricatorCampfireProtocolAdapter.php | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/infrastructure/daemon/bot/PhabricatorBot.php b/src/infrastructure/daemon/bot/PhabricatorBot.php index 1159726acb..6a803b22d6 100644 --- a/src/infrastructure/daemon/bot/PhabricatorBot.php +++ b/src/infrastructure/daemon/bot/PhabricatorBot.php @@ -107,7 +107,7 @@ final class PhabricatorBot extends PhabricatorDaemon { private function routeMessage(PhabricatorBotMessage $message) { $ignore = $this->getConfig('ignore'); - if ($ignore && in_array($message->getSenderNickName(), $ignore)) { + if ($ignore && in_array($message->getSender(), $ignore)) { return; } diff --git a/src/infrastructure/daemon/bot/adapter/PhabricatorCampfireProtocolAdapter.php b/src/infrastructure/daemon/bot/adapter/PhabricatorCampfireProtocolAdapter.php index 1c94d0c27b..74b280feff 100644 --- a/src/infrastructure/daemon/bot/adapter/PhabricatorCampfireProtocolAdapter.php +++ b/src/infrastructure/daemon/bot/adapter/PhabricatorCampfireProtocolAdapter.php @@ -118,6 +118,7 @@ extends PhabricatorBaseProtocolAdapter { return id(new PhabricatorBotMessage()) ->setCommand('MESSAGE') + ->setSender($m_obj['user_id']) ->setTarget($m_obj['room_id']) ->setBody($m_obj['body']); }