From 204d6481e4ad0842c8c467d015a140c037d9c26b Mon Sep 17 00:00:00 2001 From: John Watson Date: Wed, 20 Feb 2013 12:30:06 -0800 Subject: [PATCH] Fix PhabricatorBot ignore messages from senders Summary: PhabricatorBotMessage->getSender returns a PhabricatorBotUser object (which potentially can be null) So check null and then use getName to get actual name of the sender Test Plan: Run phabot and add myself to ignore list Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Differential Revision: https://secure.phabricator.com/D5036 --- src/infrastructure/daemon/bot/PhabricatorBot.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/infrastructure/daemon/bot/PhabricatorBot.php b/src/infrastructure/daemon/bot/PhabricatorBot.php index 78ccab5140..656c5861fd 100644 --- a/src/infrastructure/daemon/bot/PhabricatorBot.php +++ b/src/infrastructure/daemon/bot/PhabricatorBot.php @@ -107,8 +107,11 @@ final class PhabricatorBot extends PhabricatorDaemon { private function routeMessage(PhabricatorBotMessage $message) { $ignore = $this->getConfig('ignore'); - if ($ignore && in_array($message->getSender(), $ignore)) { - return; + if ($ignore) { + $sender = $message->getSender(); + if ($sender && in_array($sender->getName(), $ignore)) { + return; + } } foreach ($this->handlers as $handler) {