mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-10 00:42:41 +01:00
Render linked JIRA issues with a Doorkeeper tag
Summary: Fixes T3687. Instead of rendering "JIRA Issues" in Differential using plain links, render them using Doorkeeper tags so they get the nice "enhance with object name" effect. Test Plan: {F84886} Reviewers: btrahan Reviewed By: btrahan CC: aran Maniphest Tasks: T3687 Differential Revision: https://secure.phabricator.com/D7648
This commit is contained in:
parent
3c21375930
commit
8b19465a9d
3 changed files with 47 additions and 8 deletions
|
@ -621,6 +621,7 @@ phutil_register_library_map(array(
|
|||
'DoorkeeperRemarkupRule' => 'applications/doorkeeper/remarkup/DoorkeeperRemarkupRule.php',
|
||||
'DoorkeeperRemarkupRuleAsana' => 'applications/doorkeeper/remarkup/DoorkeeperRemarkupRuleAsana.php',
|
||||
'DoorkeeperRemarkupRuleJIRA' => 'applications/doorkeeper/remarkup/DoorkeeperRemarkupRuleJIRA.php',
|
||||
'DoorkeeperTagView' => 'applications/doorkeeper/view/DoorkeeperTagView.php',
|
||||
'DoorkeeperTagsController' => 'applications/doorkeeper/controller/DoorkeeperTagsController.php',
|
||||
'DrydockAllocatorWorker' => 'applications/drydock/worker/DrydockAllocatorWorker.php',
|
||||
'DrydockApacheWebrootInterface' => 'applications/drydock/interface/webroot/DrydockApacheWebrootInterface.php',
|
||||
|
@ -2944,6 +2945,7 @@ phutil_register_library_map(array(
|
|||
'DoorkeeperRemarkupRule' => 'PhutilRemarkupRule',
|
||||
'DoorkeeperRemarkupRuleAsana' => 'DoorkeeperRemarkupRule',
|
||||
'DoorkeeperRemarkupRuleJIRA' => 'DoorkeeperRemarkupRule',
|
||||
'DoorkeeperTagView' => 'AphrontView',
|
||||
'DoorkeeperTagsController' => 'PhabricatorController',
|
||||
'DrydockAllocatorWorker' => 'PhabricatorWorker',
|
||||
'DrydockApacheWebrootInterface' => 'DrydockWebrootInterface',
|
||||
|
|
|
@ -58,16 +58,11 @@ final class DifferentialJIRAIssuesFieldSpecification
|
|||
|
||||
$links = array();
|
||||
foreach ($xobjs as $xobj) {
|
||||
$links[] = phutil_tag(
|
||||
'a',
|
||||
array(
|
||||
'href' => $xobj->getObjectURI(),
|
||||
'target' => '_blank',
|
||||
),
|
||||
$xobj->getObjectID());
|
||||
$links[] = id(new DoorkeeperTagView())
|
||||
->setExternalObject($xobj);
|
||||
}
|
||||
|
||||
return phutil_implode_html(', ', $links);
|
||||
return phutil_implode_html(phutil_tag('br'), $links);
|
||||
}
|
||||
|
||||
public function shouldAppearOnConduitView() {
|
||||
|
|
42
src/applications/doorkeeper/view/DoorkeeperTagView.php
Normal file
42
src/applications/doorkeeper/view/DoorkeeperTagView.php
Normal file
|
@ -0,0 +1,42 @@
|
|||
<?php
|
||||
|
||||
final class DoorkeeperTagView extends AphrontView {
|
||||
|
||||
private $xobj;
|
||||
|
||||
public function setExternalObject(DoorkeeperExternalObject $xobj) {
|
||||
$this->xobj = $xobj;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function render() {
|
||||
$xobj = $this->xobj;
|
||||
if (!$xobj) {
|
||||
throw new Exception('Call setExternalObject() before render()!');
|
||||
}
|
||||
|
||||
$tag_id = celerity_generate_unique_node_id();
|
||||
|
||||
$href = $xobj->getObjectURI();
|
||||
|
||||
$spec = array(
|
||||
'id' => $tag_id,
|
||||
'ref' => array(
|
||||
$xobj->getApplicationType(),
|
||||
$xobj->getApplicationDomain(),
|
||||
$xobj->getObjectType(),
|
||||
$xobj->getObjectID(),
|
||||
),
|
||||
);
|
||||
|
||||
Javelin::initBehavior('doorkeeper-tag', array('tags' => array($spec)));
|
||||
|
||||
return id(new PhabricatorTagView())
|
||||
->setID($tag_id)
|
||||
->setHref($href)
|
||||
->setName($href)
|
||||
->setType(PhabricatorTagView::TYPE_OBJECT)
|
||||
->setExternal(true);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in a new issue