diff --git a/src/applications/transactions/feed/PhabricatorApplicationTransactionFeedStory.php b/src/applications/transactions/feed/PhabricatorApplicationTransactionFeedStory.php index 0a04a29380..9a5f5b0ec5 100644 --- a/src/applications/transactions/feed/PhabricatorApplicationTransactionFeedStory.php +++ b/src/applications/transactions/feed/PhabricatorApplicationTransactionFeedStory.php @@ -48,4 +48,9 @@ class PhabricatorApplicationTransactionFeedStory return $view; } + public function renderText() { + // TODO: This is grotesque; the feed notification handler relies on it. + return strip_tags($this->renderView()->render()); + } + } diff --git a/src/infrastructure/daemon/bot/handler/PhabricatorBotDifferentialNotificationHandler.php b/src/infrastructure/daemon/bot/handler/PhabricatorBotDifferentialNotificationHandler.php index 3a252cfc5e..2eddba29ad 100644 --- a/src/infrastructure/daemon/bot/handler/PhabricatorBotDifferentialNotificationHandler.php +++ b/src/infrastructure/daemon/bot/handler/PhabricatorBotDifferentialNotificationHandler.php @@ -1,55 +1,18 @@ getConfig('notification.actions'); - - if (!$this->skippedOldEvents) { - // Since we only want to post notifications about new events, skip - // everything that's happened in the past when we start up so we'll - // only process real-time events. - foreach ($iterator as $event) { - // Ignore all old events. - } - $this->skippedOldEvents = true; - return; - } - - foreach ($iterator as $event) { - $data = $event->getData(); - if (!$data || ($show !== null && !in_array($data['action'], $show))) { - continue; - } - - $actor_phid = $data['actor_phid']; - $phids = array($actor_phid); - $handles = id(new PhabricatorObjectHandleData($phids))->loadHandles(); - $verb = DifferentialAction::getActionPastTenseVerb($data['action']); - - $actor_name = $handles[$actor_phid]->getName(); - $message_body = - "{$actor_name} {$verb} revision D".$data['revision_id']."."; - - $channels = $this->getConfig('notification.channels', array()); - foreach ($channels as $channel) { - $this->writeMessage( - id(new PhabricatorBotMessage()) - ->setCommand('MESSAGE') - ->setTarget($channel) - ->setBody($message_body)); - } + static $notified; + if (!$notified) { + phlog( + 'PhabricatorBotDifferentialNotificationHandler is deprecated, use '. + 'PhabricatorBotFeedNotificationHandler instead.'); + $notified = true; } } diff --git a/src/infrastructure/daemon/bot/handler/PhabricatorBotFeedNotificationHandler.php b/src/infrastructure/daemon/bot/handler/PhabricatorBotFeedNotificationHandler.php index abec6a5664..eb4c5c6151 100644 --- a/src/infrastructure/daemon/bot/handler/PhabricatorBotFeedNotificationHandler.php +++ b/src/infrastructure/daemon/bot/handler/PhabricatorBotFeedNotificationHandler.php @@ -149,7 +149,11 @@ final class PhabricatorBotFeedNotificationHandler } $channels = $this->getConfig('join'); - foreach ($channels as $channel) { + foreach ($channels as $channel_name) { + + $channel = id(new PhabricatorBotChannel()) + ->setName($channel_name); + $this->writeMessage( id(new PhabricatorBotMessage()) ->setCommand('MESSAGE')