mirror of
https://we.phorge.it/source/phorge.git
synced 2025-01-02 02:40:58 +01:00
Policy - make policy transactions render better in email
Summary: right now you get sent an email with a broken link 'cuz the email is plain text if you edit something with the edit policy being a project. Test Plan: edited a legalpad document edit policy repeatedly to various projects. observed good emails via bin/mail debug tool. object page still looked good too Reviewers: epriestley Reviewed By: epriestley CC: Korvin, aran Differential Revision: https://secure.phabricator.com/D7149
This commit is contained in:
parent
874a9b7fe3
commit
4163da9d62
1 changed files with 16 additions and 12 deletions
|
@ -202,6 +202,18 @@ abstract class PhabricatorApplicationTransaction
|
||||||
return phutil_implode_html(', ', $links);
|
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() {
|
public function getIcon() {
|
||||||
switch ($this->getTransactionType()) {
|
switch ($this->getTransactionType()) {
|
||||||
case PhabricatorTransactions::TYPE_COMMENT:
|
case PhabricatorTransactions::TYPE_COMMENT:
|
||||||
|
@ -281,23 +293,15 @@ abstract class PhabricatorApplicationTransaction
|
||||||
'%s changed the visibility of this %s from "%s" to "%s".',
|
'%s changed the visibility of this %s from "%s" to "%s".',
|
||||||
$this->renderHandleLink($author_phid),
|
$this->renderHandleLink($author_phid),
|
||||||
$this->getApplicationObjectTypeName(),
|
$this->getApplicationObjectTypeName(),
|
||||||
PhabricatorPolicy::newFromPolicyAndHandle(
|
$this->renderPolicyName($old),
|
||||||
$old,
|
$this->renderPolicyName($new));
|
||||||
$this->getHandleIfExists($old))->renderDescription(),
|
|
||||||
PhabricatorPolicy::newFromPolicyAndHandle(
|
|
||||||
$new,
|
|
||||||
$this->getHandleIfExists($new))->renderDescription());
|
|
||||||
case PhabricatorTransactions::TYPE_EDIT_POLICY:
|
case PhabricatorTransactions::TYPE_EDIT_POLICY:
|
||||||
return pht(
|
return pht(
|
||||||
'%s changed the edit policy of this %s from "%s" to "%s".',
|
'%s changed the edit policy of this %s from "%s" to "%s".',
|
||||||
$this->renderHandleLink($author_phid),
|
$this->renderHandleLink($author_phid),
|
||||||
$this->getApplicationObjectTypeName(),
|
$this->getApplicationObjectTypeName(),
|
||||||
PhabricatorPolicy::newFromPolicyAndHandle(
|
$this->renderPolicyName($old),
|
||||||
$old,
|
$this->renderPolicyName($new));
|
||||||
$this->getHandleIfExists($old))->renderDescription(),
|
|
||||||
PhabricatorPolicy::newFromPolicyAndHandle(
|
|
||||||
$new,
|
|
||||||
$this->getHandleIfExists($new))->renderDescription());
|
|
||||||
case PhabricatorTransactions::TYPE_SUBSCRIBERS:
|
case PhabricatorTransactions::TYPE_SUBSCRIBERS:
|
||||||
$add = array_diff($new, $old);
|
$add = array_diff($new, $old);
|
||||||
$rem = array_diff($old, $new);
|
$rem = array_diff($old, $new);
|
||||||
|
|
Loading…
Reference in a new issue