1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-09-20 17:28:51 +02:00

Unfatal rendering of repository policy transactions

Summary: Fixes T4919. There's some special casing in Diffusion for CAN_PUSH right now, just accommodate that until things get more general.

Test Plan: Viewed a repository edit screen with a custom policy transaction. Clicked the link to view it.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T4919

Differential Revision: https://secure.phabricator.com/D8898
This commit is contained in:
epriestley 2014-04-29 10:57:32 -07:00
parent 301c7d0a14
commit 692a28b5b2
3 changed files with 8 additions and 3 deletions

View file

@ -338,8 +338,8 @@ final class PhabricatorRepositoryTransaction
return pht( return pht(
'%s changed the push policy of this repository from "%s" to "%s".', '%s changed the push policy of this repository from "%s" to "%s".',
$this->renderHandleLink($author_phid), $this->renderHandleLink($author_phid),
$this->renderPolicyName($old), $this->renderPolicyName($old, 'old'),
$this->renderPolicyName($new)); $this->renderPolicyName($new, 'new'));
case self::TYPE_DANGEROUS: case self::TYPE_DANGEROUS:
if ($new) { if ($new) {
return pht( return pht(

View file

@ -27,10 +27,15 @@ final class PhabricatorApplicationTransactionValueController
// to show the details of custom policies. If / when this pathway // to show the details of custom policies. If / when this pathway
// supports more transaction types, rendering coding should be moved // supports more transaction types, rendering coding should be moved
// into PhabricatorTransactions e.g. feed rendering code. // into PhabricatorTransactions e.g. feed rendering code.
// TODO: This should be some kind of "hey do you support this?" thing on
// the transactions themselves.
switch ($xaction->getTransactionType()) { switch ($xaction->getTransactionType()) {
case PhabricatorTransactions::TYPE_VIEW_POLICY: case PhabricatorTransactions::TYPE_VIEW_POLICY:
case PhabricatorTransactions::TYPE_EDIT_POLICY: case PhabricatorTransactions::TYPE_EDIT_POLICY:
case PhabricatorTransactions::TYPE_JOIN_POLICY: case PhabricatorTransactions::TYPE_JOIN_POLICY:
case PhabricatorRepositoryTransaction::TYPE_PUSH_POLICY:
break; break;
default: default:
return new Aphront404Response(); return new Aphront404Response();

View file

@ -311,7 +311,7 @@ abstract class PhabricatorApplicationTransaction
} }
} }
private function renderPolicyName($phid, $state = 'old') { protected function renderPolicyName($phid, $state = 'old') {
$policy = PhabricatorPolicy::newFromPolicyAndHandle( $policy = PhabricatorPolicy::newFromPolicyAndHandle(
$phid, $phid,
$this->getHandleIfExists($phid)); $this->getHandleIfExists($phid));