Page MenuHomePhabricator

D12773.diff
No OneTemporary

D12773.diff

diff --git a/src/infrastructure/daemon/bot/PhabricatorBot.php b/src/infrastructure/daemon/bot/PhabricatorBot.php
--- a/src/infrastructure/daemon/bot/PhabricatorBot.php
+++ b/src/infrastructure/daemon/bot/PhabricatorBot.php
@@ -53,8 +53,7 @@
$conduit_uri = idx($config, 'conduit.uri');
if ($conduit_uri) {
- $conduit_user = idx($config, 'conduit.user');
- $conduit_cert = idx($config, 'conduit.cert');
+ $conduit_token = idx($config, 'conduit.token');
// Normalize the path component of the URI so users can enter the
// domain without the "/api/" part.
@@ -64,16 +63,23 @@
$conduit_uri = (string)$conduit_uri->setPath('/api/');
$conduit = new ConduitClient($conduit_uri);
- $response = $conduit->callMethodSynchronous(
- 'conduit.connect',
- array(
- 'client' => 'PhabricatorBot',
- 'clientVersion' => '1.0',
- 'clientDescription' => php_uname('n').':'.$nick,
- 'host' => $conduit_host,
- 'user' => $conduit_user,
- 'certificate' => $conduit_cert,
- ));
+ if ($conduit_token) {
+ $conduit->setConduitToken($conduit_token);
+ } else {
+ $conduit_user = idx($config, 'conduit.user');
+ $conduit_cert = idx($config, 'conduit.cert');
+
+ $response = $conduit->callMethodSynchronous(
+ 'conduit.connect',
+ array(
+ 'client' => 'PhabricatorBot',
+ 'clientVersion' => '1.0',
+ 'clientDescription' => php_uname('n').':'.$nick,
+ 'host' => $conduit_host,
+ 'user' => $conduit_user,
+ 'certificate' => $conduit_cert,
+ ));
+ }
$this->conduit = $conduit;
}
diff --git a/src/infrastructure/daemon/bot/handler/PhabricatorBotObjectNameHandler.php b/src/infrastructure/daemon/bot/handler/PhabricatorBotObjectNameHandler.php
--- a/src/infrastructure/daemon/bot/handler/PhabricatorBotObjectNameHandler.php
+++ b/src/infrastructure/daemon/bot/handler/PhabricatorBotObjectNameHandler.php
@@ -26,7 +26,7 @@
$pattern =
'@'.
- '(?<!/)(?:^|\b)'.
+ '(?<![/:#-])(?:^|\b)'.
'(R2D2)'.
'(?:\b|$)'.
'@';
@@ -41,9 +41,11 @@
}
}
+ // Use a negative lookbehind to prevent matching "/D123", "#D123",
+ // ":D123", etc.
$pattern =
'@'.
- '(?<!/)(?:^|\b)'. // Negative lookbehind prevent matching "/D123".
+ '(?<![/:#-])(?:^|\b)'.
'([A-Z])(\d+)'.
'(?:\b|$)'.
'@';
@@ -158,15 +160,12 @@
if ($commit_names) {
$commits = $this->getConduit()->callMethodSynchronous(
- 'diffusion.getcommits',
+ 'diffusion.querycommits',
array(
- 'commits' => $commit_names,
+ 'names' => $commit_names,
));
- foreach ($commits as $commit) {
- if (isset($commit['error'])) {
- continue;
- }
- $output[$commit['commitPHID']] = $commit['uri'];
+ foreach ($commits['data'] as $commit) {
+ $output[$commit['phid']] = $commit['uri'];
}
}

File Metadata

Mime Type
text/plain
Expires
Wed, Dec 25, 11:34 AM (11 h, 2 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6926068
Default Alt Text
D12773.diff (3 KB)

Event Timeline