1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-20 13:52:40 +01:00

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
This commit is contained in:
Bob Trahan 2015-02-03 13:44:20 -08:00
parent 461b09d17e
commit 137b0ebc53

View file

@ -131,21 +131,28 @@ final class PhabricatorBotObjectNameHandler extends PhabricatorBotHandler {
if ($paste_ids) { if ($paste_ids) {
foreach ($paste_ids as $paste_id) { foreach ($paste_ids as $paste_id) {
$paste = $this->getConduit()->callMethodSynchronous( $paste = $this->getConduit()->callMethodSynchronous(
'paste.info', 'paste.query',
array( array(
'paste_id' => $paste_id, 'ids' => array($paste_id),
)); ));
// Eventually I'd like to show the username of the paster as well, $paste = head($paste);
// however that will need something like a user.username_from_phid
// since we (ideally) want to keep the bot to Conduit calls...and
// not call to Phabricator-specific stuff (like actually loading
// the User object and fetching his/her username.)
$output[$paste['phid']] = 'P'.$paste['id'].': '.$paste['uri'].' - '. $output[$paste['phid']] = 'P'.$paste['id'].': '.$paste['uri'].' - '.
$paste['title']; $paste['title'];
if ($paste['language']) { if ($paste['language']) {
$output[$paste['phid']] .= ' ('.$paste['language'].')'; $output[$paste['phid']] .= ' ('.$paste['language'].')';
} }
$user = $this->getConduit()->callMethodSynchronous(
'user.query',
array(
'phids' => array($paste['authorPHID']),
));
$user = head($user);
if ($user) {
$output[$paste['phid']] .= ' by '.$user['userName'];
}
} }
} }