1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-18 21:02:41 +01:00

Merge pull request #28 from CodeBlock/3346f04d89548ebfa6e84c6bada01b84b

D552 and 553.
This commit is contained in:
Evan Priestley 2011-06-29 12:16:57 -07:00
commit edf6a44db3
3 changed files with 23 additions and 1 deletions

View file

@ -52,6 +52,7 @@ class ConduitAPI_paste_info_Method extends ConduitAPIMethod {
'filePHID' => $paste->getFilePHID(),
'title' => $paste->getTitle(),
'dateCreated' => $paste->getDateCreated(),
'uri' => PhabricatorEnv::getProductionURI('/P'.$paste->getID()),
);
return $result;

View file

@ -9,6 +9,7 @@
phutil_require_module('phabricator', 'applications/conduit/method/base');
phutil_require_module('phabricator', 'applications/conduit/protocol/exception');
phutil_require_module('phabricator', 'applications/paste/storage/paste');
phutil_require_module('phabricator', 'infrastructure/env');
phutil_require_module('phutil', 'utils');

View file

@ -45,12 +45,13 @@ class PhabricatorIRCObjectNameHandler extends PhabricatorIRCHandler {
$pattern =
'@'.
'(?<!/)(?:^|\b)'. // Negative lookbehind prevent matching "/D123".
'(D|T)(\d+)'.
'(D|T|P)(\d+)'.
'(?:\b|$)'.
'@';
$revision_ids = array();
$task_ids = array();
$paste_ids = array();
$commit_names = array();
if (preg_match_all($pattern, $message, $matches, PREG_SET_ORDER)) {
@ -62,6 +63,9 @@ class PhabricatorIRCObjectNameHandler extends PhabricatorIRCHandler {
case 'T':
$task_ids[] = $match[2];
break;
case 'P':
$paste_ids[] = $match[2];
break;
}
}
}
@ -106,6 +110,22 @@ class PhabricatorIRCObjectNameHandler extends PhabricatorIRCHandler {
}
}
if ($paste_ids) {
foreach ($paste_ids as $paste_id) {
$paste = $this->getConduit()->callMethodSynchronous(
'paste.info',
array(
'paste_id' => $paste_id,
));
// Eventually I'd like to show the username of the paster as well,
// 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'];
}
}
if ($commit_names) {
$commits = $this->getConduit()->callMethodSynchronous(
'diffusion.getcommits',