Page MenuHomePhabricator

D9858.id23656.diff
No OneTemporary

D9858.id23656.diff

diff --git a/src/applications/doorkeeper/worker/DoorkeeperFeedWorkerJIRA.php b/src/applications/doorkeeper/worker/DoorkeeperFeedWorkerJIRA.php
--- a/src/applications/doorkeeper/worker/DoorkeeperFeedWorkerJIRA.php
+++ b/src/applications/doorkeeper/worker/DoorkeeperFeedWorkerJIRA.php
@@ -54,7 +54,7 @@
return;
}
- $story_text = $this->renderStoryText();
+ $uri = $publisher->getObjectURI($object);
$xobjs = mgroup($xobjs, 'getApplicationDomain');
foreach ($xobjs as $domain => $xobj_list) {
@@ -75,10 +75,29 @@
try {
$provider->newJIRAFuture(
$account,
- 'rest/api/2/issue/'.$xobj->getObjectID().'/comment',
+ 'rest/api/2/issue/'.$xobj->getObjectID().'/remotelink',
'POST',
+ // format documented at https://developer.atlassian.com/display/JIRADEV/Fields+in+Remote+Issue+Links
array(
- 'body' => $story_text,
+ 'globalId' => $uri, // assumes URI will always be <255 characters
+ 'application' => array(
+ 'type' => 'org.phacility.differential',
+ 'name' => 'Differential',
+ ),
+ 'relationship' => 'implemented in',
+ 'object' => array(
+ 'url' => $uri,
+ 'title' => $object->getMonogram(),
+ 'summary' => $object->getTitle(),
+ 'icon' => array(
+ // TODO use Differential gear icon in 16x16, hosted locally
+ 'url16x16' => 'https://secure.phabricator.com/rsrc/image/apple-touch-icon.png',
+ 'title' => 'Revision',
+ ),
+ 'status' => array(
+ 'resolved' => $object->isClosed()
+ ),
+ ),
))->resolveJSON();
break;
} catch (HTTPFutureResponseStatus $ex) {
@@ -156,14 +175,4 @@
return $try_users;
}
- private function renderStoryText() {
- $object = $this->getStoryObject();
- $publisher = $this->getPublisher();
-
- $text = $publisher->getStoryText($object);
- $uri = $publisher->getObjectURI($object);
-
- return $text."\n\n".$uri;
- }
-
}

File Metadata

Mime Type
text/plain
Expires
Mon, Oct 6, 10:22 AM (2 w, 3 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
12402213
Default Alt Text
D9858.id23656.diff (2 KB)

Event Timeline