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:
parent
989b585bbe
commit
0569938880
3 changed files with 27 additions and 0 deletions
|
@ -14,6 +14,7 @@ final class PHUIHandleView
|
||||||
private $handleList;
|
private $handleList;
|
||||||
private $handlePHID;
|
private $handlePHID;
|
||||||
private $asTag;
|
private $asTag;
|
||||||
|
private $asText;
|
||||||
private $useShortName;
|
private $useShortName;
|
||||||
private $showHovercard;
|
private $showHovercard;
|
||||||
|
|
||||||
|
@ -32,6 +33,11 @@ final class PHUIHandleView
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function setAsText($as_text) {
|
||||||
|
$this->asText = $as_text;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
public function setUseShortName($short) {
|
public function setUseShortName($short) {
|
||||||
$this->useShortName = $short;
|
$this->useShortName = $short;
|
||||||
return $this;
|
return $this;
|
||||||
|
@ -55,6 +61,10 @@ final class PHUIHandleView
|
||||||
return $tag;
|
return $tag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($this->asText) {
|
||||||
|
return $handle->getLinkName();
|
||||||
|
}
|
||||||
|
|
||||||
if ($this->useShortName) {
|
if ($this->useShortName) {
|
||||||
$name = $handle->getName();
|
$name = $handle->getName();
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -116,6 +116,11 @@ abstract class PhabricatorModularTransaction
|
||||||
return parent::getColor();
|
return parent::getColor();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function attachViewer(PhabricatorUser $viewer) {
|
||||||
|
$this->getTransactionImplementation()->setViewer($viewer);
|
||||||
|
return parent::attachViewer($viewer);
|
||||||
|
}
|
||||||
|
|
||||||
final public function hasChangeDetails() {
|
final public function hasChangeDetails() {
|
||||||
if ($this->getTransactionImplementation()->hasChangeDetailView()) {
|
if ($this->getTransactionImplementation()->hasChangeDetailView()) {
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -129,6 +129,18 @@ abstract class PhabricatorModularTransactionType
|
||||||
return $this->getStorage()->renderHandleLink($object_phid);
|
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) {
|
final protected function newError($title, $message, $xaction = null) {
|
||||||
return new PhabricatorApplicationTransactionValidationError(
|
return new PhabricatorApplicationTransactionValidationError(
|
||||||
$this->getTransactionTypeConstant(),
|
$this->getTransactionTypeConstant(),
|
||||||
|
|
Loading…
Reference in a new issue