Differential D11664 Diff 28072 src/infrastructure/daemon/bot/handler/PhabricatorBotObjectNameHandler.php
Changeset View
Changeset View
Standalone View
Standalone View
src/infrastructure/daemon/bot/handler/PhabricatorBotObjectNameHandler.php
Show First 20 Lines • Show All 125 Lines • ▼ Show 20 Lines | switch ($original_message->getCommand()) { | ||||
$output[$file['phid']] = $file['objectName'].': '. | $output[$file['phid']] = $file['objectName'].': '. | ||||
$file['uri'].' - '.$file['name']; | $file['uri'].' - '.$file['name']; | ||||
} | } | ||||
} | } | ||||
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']; | |||||
} | |||||
} | } | ||||
} | } | ||||
if ($commit_names) { | if ($commit_names) { | ||||
$commits = $this->getConduit()->callMethodSynchronous( | $commits = $this->getConduit()->callMethodSynchronous( | ||||
'diffusion.getcommits', | 'diffusion.getcommits', | ||||
array( | array( | ||||
'commits' => $commit_names, | 'commits' => $commit_names, | ||||
Show All 38 Lines |