1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-19 12:00:55 +01:00

expose renderHandle in PhabricatorModularTransactionType

Test Plan: Tested with a transactionType from an extension.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin

Maniphest Tasks: T9789

Differential Revision: https://secure.phabricator.com/D16236
This commit is contained in:
Aviv Eyal 2016-07-06 01:54:51 +00:00 committed by avivey
parent 989b585bbe
commit 0569938880
3 changed files with 27 additions and 0 deletions

View file

@ -14,6 +14,7 @@ final class PHUIHandleView
private $handleList;
private $handlePHID;
private $asTag;
private $asText;
private $useShortName;
private $showHovercard;
@ -32,6 +33,11 @@ final class PHUIHandleView
return $this;
}
public function setAsText($as_text) {
$this->asText = $as_text;
return $this;
}
public function setUseShortName($short) {
$this->useShortName = $short;
return $this;
@ -55,6 +61,10 @@ final class PHUIHandleView
return $tag;
}
if ($this->asText) {
return $handle->getLinkName();
}
if ($this->useShortName) {
$name = $handle->getName();
} else {

View file

@ -116,6 +116,11 @@ abstract class PhabricatorModularTransaction
return parent::getColor();
}
public function attachViewer(PhabricatorUser $viewer) {
$this->getTransactionImplementation()->setViewer($viewer);
return parent::attachViewer($viewer);
}
final public function hasChangeDetails() {
if ($this->getTransactionImplementation()->hasChangeDetailView()) {
return true;

View file

@ -129,6 +129,18 @@ abstract class PhabricatorModularTransactionType
return $this->getStorage()->renderHandleLink($object_phid);
}
final protected function renderHandle($phid) {
$viewer = $this->getViewer();
$display = $viewer->renderHandle($phid);
$rendering_target = $this->getStorage()->getRenderingTarget();
if ($rendering_target == PhabricatorApplicationTransaction::TARGET_TEXT) {
$display->setAsText(true);
}
return $display;
}
final protected function newError($title, $message, $xaction = null) {
return new PhabricatorApplicationTransactionValidationError(
$this->getTransactionTypeConstant(),