@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.

Phabot / Conduit - stop using deprecated conduit api paste.info

Summary: Fixes T7111. Also nails out the TODO to show the username

Test Plan: fired up the ole phabot, chatted "P123" and saw "P123: https://secure.phabricator.com/P123 - Masterwork From Distant Lands by epriestley"...!

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin, epriestley

Maniphest Tasks: T7111

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

+14 -7
+14 -7
src/infrastructure/daemon/bot/handler/PhabricatorBotObjectNameHandler.php
··· 131 131 if ($paste_ids) { 132 132 foreach ($paste_ids as $paste_id) { 133 133 $paste = $this->getConduit()->callMethodSynchronous( 134 - 'paste.info', 134 + 'paste.query', 135 135 array( 136 - 'paste_id' => $paste_id, 136 + 'ids' => array($paste_id), 137 137 )); 138 - // Eventually I'd like to show the username of the paster as well, 139 - // however that will need something like a user.username_from_phid 140 - // since we (ideally) want to keep the bot to Conduit calls...and 141 - // not call to Phabricator-specific stuff (like actually loading 142 - // the User object and fetching his/her username.) 138 + $paste = head($paste); 139 + 143 140 $output[$paste['phid']] = 'P'.$paste['id'].': '.$paste['uri'].' - '. 144 141 $paste['title']; 145 142 146 143 if ($paste['language']) { 147 144 $output[$paste['phid']] .= ' ('.$paste['language'].')'; 145 + } 146 + 147 + $user = $this->getConduit()->callMethodSynchronous( 148 + 'user.query', 149 + array( 150 + 'phids' => array($paste['authorPHID']), 151 + )); 152 + $user = head($user); 153 + if ($user) { 154 + $output[$paste['phid']] .= ' by '.$user['userName']; 148 155 } 149 156 } 150 157 }