@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Make PhabricatorBotFeedNotificationHandler work with new PhabricatorApplicationTransactionFeedStory

Summary: Depends on D8521

Test Plan: ran with handler enabled and phabot posted stories

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: aran, epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D8524

authored by

John Watson and committed by
epriestley
a5f6e19d 8789f978

+19 -3
+19 -3
src/infrastructure/daemon/bot/handler/PhabricatorBotFeedNotificationHandler.php
··· 11 11 private $startupDelay = 30; 12 12 private $lastSeenChronoKey = 0; 13 13 14 + private $typesNeedURI = array('DREV', 'TASK'); 15 + 14 16 private function shouldShowStory($story) { 15 - $story_class = $story['class']; 17 + $story_objectphid = $story['objectPHID']; 16 18 $story_text = $story['text']; 17 19 18 20 $show = $this->getConfig('notification.types'); 19 21 20 22 if ($show) { 21 - $obj_type = str_replace('PhabricatorFeedStory', '', $story_class); 23 + $obj_type = phid_get_type($story_objectphid); 22 24 if (!in_array(strtolower($obj_type), $show)) { 23 25 return false; 24 26 } ··· 62 64 'closed', 63 65 'raised', 64 66 'committed', 67 + 'abandoned', 68 + 'reclaimed', 65 69 'reopened', 66 70 'deleted' 67 71 ); ··· 148 152 continue; 149 153 } 150 154 155 + $message = $story['text']; 156 + 157 + $story_object_type = phid_get_type($story['objectPHID']); 158 + if (in_array($story_object_type, $this->typesNeedURI)) { 159 + $objects = $this->getConduit()->callMethodSynchronous( 160 + 'phid.lookup', 161 + array( 162 + 'names' => array($story['objectPHID']), 163 + )); 164 + $message .= ' '.$objects[$story['objectPHID']]['uri']; 165 + } 166 + 151 167 $channels = $this->getConfig('join'); 152 168 foreach ($channels as $channel_name) { 153 169 ··· 158 174 id(new PhabricatorBotMessage()) 159 175 ->setCommand('MESSAGE') 160 176 ->setTarget($channel) 161 - ->setBody($story['text'])); 177 + ->setBody($message)); 162 178 } 163 179 } 164 180 }