@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

+16 -12
+16 -12
src/applications/transactions/storage/PhabricatorApplicationTransaction.php
··· 202 202 return phutil_implode_html(', ', $links); 203 203 } 204 204 205 + public function renderPolicyName($phid) { 206 + $policy = PhabricatorPolicy::newFromPolicyAndHandle( 207 + $phid, 208 + $this->getHandleIfExists($phid)); 209 + if ($this->renderingTarget == self::TARGET_HTML) { 210 + $output = $policy->renderDescription(); 211 + } else { 212 + $output = hsprintf('%s', $policy->getFullName()); 213 + } 214 + return $output; 215 + } 216 + 205 217 public function getIcon() { 206 218 switch ($this->getTransactionType()) { 207 219 case PhabricatorTransactions::TYPE_COMMENT: ··· 281 293 '%s changed the visibility of this %s from "%s" to "%s".', 282 294 $this->renderHandleLink($author_phid), 283 295 $this->getApplicationObjectTypeName(), 284 - PhabricatorPolicy::newFromPolicyAndHandle( 285 - $old, 286 - $this->getHandleIfExists($old))->renderDescription(), 287 - PhabricatorPolicy::newFromPolicyAndHandle( 288 - $new, 289 - $this->getHandleIfExists($new))->renderDescription()); 296 + $this->renderPolicyName($old), 297 + $this->renderPolicyName($new)); 290 298 case PhabricatorTransactions::TYPE_EDIT_POLICY: 291 299 return pht( 292 300 '%s changed the edit policy of this %s from "%s" to "%s".', 293 301 $this->renderHandleLink($author_phid), 294 302 $this->getApplicationObjectTypeName(), 295 - PhabricatorPolicy::newFromPolicyAndHandle( 296 - $old, 297 - $this->getHandleIfExists($old))->renderDescription(), 298 - PhabricatorPolicy::newFromPolicyAndHandle( 299 - $new, 300 - $this->getHandleIfExists($new))->renderDescription()); 303 + $this->renderPolicyName($old), 304 + $this->renderPolicyName($new)); 301 305 case PhabricatorTransactions::TYPE_SUBSCRIBERS: 302 306 $add = array_diff($new, $old); 303 307 $rem = array_diff($old, $new);