mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-19 05:12:41 +01:00
Merge pull request #28 from CodeBlock/3346f04d89548ebfa6e84c6bada01b84b
D552 and 553.
This commit is contained in:
commit
edf6a44db3
3 changed files with 23 additions and 1 deletions
|
@ -52,6 +52,7 @@ class ConduitAPI_paste_info_Method extends ConduitAPIMethod {
|
||||||
'filePHID' => $paste->getFilePHID(),
|
'filePHID' => $paste->getFilePHID(),
|
||||||
'title' => $paste->getTitle(),
|
'title' => $paste->getTitle(),
|
||||||
'dateCreated' => $paste->getDateCreated(),
|
'dateCreated' => $paste->getDateCreated(),
|
||||||
|
'uri' => PhabricatorEnv::getProductionURI('/P'.$paste->getID()),
|
||||||
);
|
);
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
phutil_require_module('phabricator', 'applications/conduit/method/base');
|
phutil_require_module('phabricator', 'applications/conduit/method/base');
|
||||||
phutil_require_module('phabricator', 'applications/conduit/protocol/exception');
|
phutil_require_module('phabricator', 'applications/conduit/protocol/exception');
|
||||||
phutil_require_module('phabricator', 'applications/paste/storage/paste');
|
phutil_require_module('phabricator', 'applications/paste/storage/paste');
|
||||||
|
phutil_require_module('phabricator', 'infrastructure/env');
|
||||||
|
|
||||||
phutil_require_module('phutil', 'utils');
|
phutil_require_module('phutil', 'utils');
|
||||||
|
|
||||||
|
|
|
@ -45,12 +45,13 @@ class PhabricatorIRCObjectNameHandler extends PhabricatorIRCHandler {
|
||||||
$pattern =
|
$pattern =
|
||||||
'@'.
|
'@'.
|
||||||
'(?<!/)(?:^|\b)'. // Negative lookbehind prevent matching "/D123".
|
'(?<!/)(?:^|\b)'. // Negative lookbehind prevent matching "/D123".
|
||||||
'(D|T)(\d+)'.
|
'(D|T|P)(\d+)'.
|
||||||
'(?:\b|$)'.
|
'(?:\b|$)'.
|
||||||
'@';
|
'@';
|
||||||
|
|
||||||
$revision_ids = array();
|
$revision_ids = array();
|
||||||
$task_ids = array();
|
$task_ids = array();
|
||||||
|
$paste_ids = array();
|
||||||
$commit_names = array();
|
$commit_names = array();
|
||||||
|
|
||||||
if (preg_match_all($pattern, $message, $matches, PREG_SET_ORDER)) {
|
if (preg_match_all($pattern, $message, $matches, PREG_SET_ORDER)) {
|
||||||
|
@ -62,6 +63,9 @@ class PhabricatorIRCObjectNameHandler extends PhabricatorIRCHandler {
|
||||||
case 'T':
|
case 'T':
|
||||||
$task_ids[] = $match[2];
|
$task_ids[] = $match[2];
|
||||||
break;
|
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) {
|
if ($commit_names) {
|
||||||
$commits = $this->getConduit()->callMethodSynchronous(
|
$commits = $this->getConduit()->callMethodSynchronous(
|
||||||
'diffusion.getcommits',
|
'diffusion.getcommits',
|
||||||
|
|
Loading…
Reference in a new issue