From 692a28b5b2df9c09a90106dc9d10daa32389f3eb Mon Sep 17 00:00:00 2001 From: epriestley Date: Tue, 29 Apr 2014 10:57:32 -0700 Subject: [PATCH] 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 --- .../repository/storage/PhabricatorRepositoryTransaction.php | 4 ++-- .../PhabricatorApplicationTransactionValueController.php | 5 +++++ .../storage/PhabricatorApplicationTransaction.php | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/applications/repository/storage/PhabricatorRepositoryTransaction.php b/src/applications/repository/storage/PhabricatorRepositoryTransaction.php index 7190dc0572..c4c9ed8b5c 100644 --- a/src/applications/repository/storage/PhabricatorRepositoryTransaction.php +++ b/src/applications/repository/storage/PhabricatorRepositoryTransaction.php @@ -338,8 +338,8 @@ final class PhabricatorRepositoryTransaction return pht( '%s changed the push policy of this repository from "%s" to "%s".', $this->renderHandleLink($author_phid), - $this->renderPolicyName($old), - $this->renderPolicyName($new)); + $this->renderPolicyName($old, 'old'), + $this->renderPolicyName($new, 'new')); case self::TYPE_DANGEROUS: if ($new) { return pht( diff --git a/src/applications/transactions/controller/PhabricatorApplicationTransactionValueController.php b/src/applications/transactions/controller/PhabricatorApplicationTransactionValueController.php index 6f40dc9c65..889bd8ddf4 100644 --- a/src/applications/transactions/controller/PhabricatorApplicationTransactionValueController.php +++ b/src/applications/transactions/controller/PhabricatorApplicationTransactionValueController.php @@ -27,10 +27,15 @@ final class PhabricatorApplicationTransactionValueController // to show the details of custom policies. If / when this pathway // supports more transaction types, rendering coding should be moved // 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()) { case PhabricatorTransactions::TYPE_VIEW_POLICY: case PhabricatorTransactions::TYPE_EDIT_POLICY: case PhabricatorTransactions::TYPE_JOIN_POLICY: + case PhabricatorRepositoryTransaction::TYPE_PUSH_POLICY: break; default: return new Aphront404Response(); diff --git a/src/applications/transactions/storage/PhabricatorApplicationTransaction.php b/src/applications/transactions/storage/PhabricatorApplicationTransaction.php index 0e8236091a..b5194c8e83 100644 --- a/src/applications/transactions/storage/PhabricatorApplicationTransaction.php +++ b/src/applications/transactions/storage/PhabricatorApplicationTransaction.php @@ -311,7 +311,7 @@ abstract class PhabricatorApplicationTransaction } } - private function renderPolicyName($phid, $state = 'old') { + protected function renderPolicyName($phid, $state = 'old') { $policy = PhabricatorPolicy::newFromPolicyAndHandle( $phid, $this->getHandleIfExists($phid));