diff --git a/src/applications/transactions/storage/PhabricatorApplicationTransaction.php b/src/applications/transactions/storage/PhabricatorApplicationTransaction.php index b1c96f1dc7..3ed95c6661 100644 --- a/src/applications/transactions/storage/PhabricatorApplicationTransaction.php +++ b/src/applications/transactions/storage/PhabricatorApplicationTransaction.php @@ -202,6 +202,18 @@ abstract class PhabricatorApplicationTransaction return phutil_implode_html(', ', $links); } + public function renderPolicyName($phid) { + $policy = PhabricatorPolicy::newFromPolicyAndHandle( + $phid, + $this->getHandleIfExists($phid)); + if ($this->renderingTarget == self::TARGET_HTML) { + $output = $policy->renderDescription(); + } else { + $output = hsprintf('%s', $policy->getFullName()); + } + return $output; + } + public function getIcon() { switch ($this->getTransactionType()) { case PhabricatorTransactions::TYPE_COMMENT: @@ -281,23 +293,15 @@ abstract class PhabricatorApplicationTransaction '%s changed the visibility of this %s from "%s" to "%s".', $this->renderHandleLink($author_phid), $this->getApplicationObjectTypeName(), - PhabricatorPolicy::newFromPolicyAndHandle( - $old, - $this->getHandleIfExists($old))->renderDescription(), - PhabricatorPolicy::newFromPolicyAndHandle( - $new, - $this->getHandleIfExists($new))->renderDescription()); + $this->renderPolicyName($old), + $this->renderPolicyName($new)); case PhabricatorTransactions::TYPE_EDIT_POLICY: return pht( '%s changed the edit policy of this %s from "%s" to "%s".', $this->renderHandleLink($author_phid), $this->getApplicationObjectTypeName(), - PhabricatorPolicy::newFromPolicyAndHandle( - $old, - $this->getHandleIfExists($old))->renderDescription(), - PhabricatorPolicy::newFromPolicyAndHandle( - $new, - $this->getHandleIfExists($new))->renderDescription()); + $this->renderPolicyName($old), + $this->renderPolicyName($new)); case PhabricatorTransactions::TYPE_SUBSCRIBERS: $add = array_diff($new, $old); $rem = array_diff($old, $new);