From f034fd80dbf7b2a63ffc06537d918de4d92dff23 Mon Sep 17 00:00:00 2001 From: epriestley Date: Tue, 20 Aug 2013 10:04:33 -0700 Subject: [PATCH] Remove getApplicationObjectTypeName from ApplicationTransactions Summary: We can get this out of PHIDType reasonably in all cases and simplify implementation here. None of these translate correctly anyway so they're basically debugging/development strings. Test Plan: `grep`, browsed some transactions Reviewers: btrahan Reviewed By: btrahan CC: aran Differential Revision: https://secure.phabricator.com/D6786 --- .../PhabricatorAuthProviderConfigTransaction.php | 4 ---- .../config/storage/PhabricatorConfigTransaction.php | 5 ----- .../conpherence/storage/ConpherenceTransaction.php | 4 ---- .../differential/storage/DifferentialTransaction.php | 4 ---- .../herald/storage/HeraldRuleTransaction.php | 4 ---- .../legalpad/storage/LegalpadTransaction.php | 4 ---- .../macro/storage/PhabricatorMacroTransaction.php | 4 ---- .../paste/storage/PhabricatorPasteTransaction.php | 4 ---- .../people/storage/PhabricatorUserTransaction.php | 4 ---- src/applications/phlux/storage/PhluxTransaction.php | 4 ---- .../pholio/storage/PholioTransaction.php | 4 ---- .../phortune/storage/PhortuneAccountTransaction.php | 4 ---- .../phortune/storage/PhortuneProductTransaction.php | 4 ---- .../ponder/storage/PonderAnswerTransaction.php | 4 ---- .../ponder/storage/PonderQuestionTransaction.php | 4 ---- .../releeph/storage/ReleephBranchTransaction.php | 4 ---- .../releeph/storage/ReleephProjectTransaction.php | 4 ---- .../releeph/storage/ReleephRequestTransaction.php | 4 ---- .../storage/PhabricatorRepositoryTransaction.php | 4 ---- .../storage/PhabricatorSlowvoteTransaction.php | 4 ---- .../storage/PhabricatorApplicationTransaction.php | 12 +++++++++++- 21 files changed, 11 insertions(+), 82 deletions(-) diff --git a/src/applications/auth/storage/PhabricatorAuthProviderConfigTransaction.php b/src/applications/auth/storage/PhabricatorAuthProviderConfigTransaction.php index 23c825caf1..ff6564c95e 100644 --- a/src/applications/auth/storage/PhabricatorAuthProviderConfigTransaction.php +++ b/src/applications/auth/storage/PhabricatorAuthProviderConfigTransaction.php @@ -34,10 +34,6 @@ final class PhabricatorAuthProviderConfigTransaction return null; } - public function getApplicationObjectTypeName() { - return pht('authentication provider'); - } - public function getIcon() { $old = $this->getOldValue(); $new = $this->getNewValue(); diff --git a/src/applications/config/storage/PhabricatorConfigTransaction.php b/src/applications/config/storage/PhabricatorConfigTransaction.php index ad03fb6b46..ebfd944252 100644 --- a/src/applications/config/storage/PhabricatorConfigTransaction.php +++ b/src/applications/config/storage/PhabricatorConfigTransaction.php @@ -17,11 +17,6 @@ final class PhabricatorConfigTransaction return null; } - public function getApplicationObjectTypeName() { - return pht('config'); - } - - public function getTitle() { $author_phid = $this->getAuthorPHID(); diff --git a/src/applications/conpherence/storage/ConpherenceTransaction.php b/src/applications/conpherence/storage/ConpherenceTransaction.php index 4d05ea7bf4..3853867b84 100644 --- a/src/applications/conpherence/storage/ConpherenceTransaction.php +++ b/src/applications/conpherence/storage/ConpherenceTransaction.php @@ -17,10 +17,6 @@ final class ConpherenceTransaction extends PhabricatorApplicationTransaction { return new ConpherenceTransactionComment(); } - public function getApplicationObjectTypeName() { - return pht('conpherence'); - } - public function getNoEffectDescription() { switch ($this->getTransactionType()) { case ConpherenceTransactionType::TYPE_PARTICIPANTS: diff --git a/src/applications/differential/storage/DifferentialTransaction.php b/src/applications/differential/storage/DifferentialTransaction.php index 738d61b9ba..745805e4a6 100644 --- a/src/applications/differential/storage/DifferentialTransaction.php +++ b/src/applications/differential/storage/DifferentialTransaction.php @@ -14,8 +14,4 @@ final class DifferentialTransaction extends PhabricatorApplicationTransaction { return new DifferentialTransactionComment(); } - public function getApplicationObjectTypeName() { - return pht('revision'); - } - } diff --git a/src/applications/herald/storage/HeraldRuleTransaction.php b/src/applications/herald/storage/HeraldRuleTransaction.php index 7b0ee05bf8..192430846b 100644 --- a/src/applications/herald/storage/HeraldRuleTransaction.php +++ b/src/applications/herald/storage/HeraldRuleTransaction.php @@ -17,9 +17,5 @@ final class HeraldRuleTransaction return new HeraldRuleTransactionComment(); } - public function getApplicationObjectTypeName() { - return pht('rule'); - } - } diff --git a/src/applications/legalpad/storage/LegalpadTransaction.php b/src/applications/legalpad/storage/LegalpadTransaction.php index e829812eab..9abf15db2d 100644 --- a/src/applications/legalpad/storage/LegalpadTransaction.php +++ b/src/applications/legalpad/storage/LegalpadTransaction.php @@ -21,10 +21,6 @@ final class LegalpadTransaction extends PhabricatorApplicationTransaction { return new LegalpadTransactionView(); } - public function getApplicationObjectTypeName() { - return pht('document'); - } - public function shouldHide() { $old = $this->getOldValue(); diff --git a/src/applications/macro/storage/PhabricatorMacroTransaction.php b/src/applications/macro/storage/PhabricatorMacroTransaction.php index bfac84cdd6..ab97055271 100644 --- a/src/applications/macro/storage/PhabricatorMacroTransaction.php +++ b/src/applications/macro/storage/PhabricatorMacroTransaction.php @@ -19,10 +19,6 @@ final class PhabricatorMacroTransaction return new PhabricatorMacroTransactionComment(); } - public function getApplicationObjectTypeName() { - return pht('macro'); - } - public function getRequiredHandlePHIDs() { $phids = parent::getRequiredHandlePHIDs(); diff --git a/src/applications/paste/storage/PhabricatorPasteTransaction.php b/src/applications/paste/storage/PhabricatorPasteTransaction.php index 2a86ff16b3..05bcb00151 100644 --- a/src/applications/paste/storage/PhabricatorPasteTransaction.php +++ b/src/applications/paste/storage/PhabricatorPasteTransaction.php @@ -22,10 +22,6 @@ final class PhabricatorPasteTransaction return new PhabricatorPasteTransactionComment(); } - public function getApplicationObjectTypeName() { - return pht('paste'); - } - public function getRequiredHandlePHIDs() { $phids = parent::getRequiredHandlePHIDs(); diff --git a/src/applications/people/storage/PhabricatorUserTransaction.php b/src/applications/people/storage/PhabricatorUserTransaction.php index 50b8c5c36a..eb7e29929e 100644 --- a/src/applications/people/storage/PhabricatorUserTransaction.php +++ b/src/applications/people/storage/PhabricatorUserTransaction.php @@ -15,9 +15,5 @@ final class PhabricatorUserTransaction return null; } - public function getApplicationObjectTypeName() { - return pht('user'); - } - } diff --git a/src/applications/phlux/storage/PhluxTransaction.php b/src/applications/phlux/storage/PhluxTransaction.php index b2712baf50..1835796620 100644 --- a/src/applications/phlux/storage/PhluxTransaction.php +++ b/src/applications/phlux/storage/PhluxTransaction.php @@ -17,10 +17,6 @@ final class PhluxTransaction extends PhabricatorApplicationTransaction { return null; } - public function getApplicationObjectTypeName() { - return pht('variable'); - } - public function getTitle() { $author_phid = $this->getAuthorPHID(); diff --git a/src/applications/pholio/storage/PholioTransaction.php b/src/applications/pholio/storage/PholioTransaction.php index 9c6a3f5b56..9ddb4c4235 100644 --- a/src/applications/pholio/storage/PholioTransaction.php +++ b/src/applications/pholio/storage/PholioTransaction.php @@ -21,10 +21,6 @@ final class PholioTransaction extends PhabricatorApplicationTransaction { return new PholioTransactionView(); } - public function getApplicationObjectTypeName() { - return pht('mock'); - } - public function getRequiredHandlePHIDs() { $phids = parent::getRequiredHandlePHIDs(); $phids[] = $this->getObjectPHID(); diff --git a/src/applications/phortune/storage/PhortuneAccountTransaction.php b/src/applications/phortune/storage/PhortuneAccountTransaction.php index 770c504853..6cb0384089 100644 --- a/src/applications/phortune/storage/PhortuneAccountTransaction.php +++ b/src/applications/phortune/storage/PhortuneAccountTransaction.php @@ -17,10 +17,6 @@ final class PhortuneAccountTransaction return null; } - public function getApplicationObjectTypeName() { - return pht('account'); - } - public function getTitle() { $author_phid = $this->getAuthorPHID(); diff --git a/src/applications/phortune/storage/PhortuneProductTransaction.php b/src/applications/phortune/storage/PhortuneProductTransaction.php index 1a9e770d1e..246b2675a3 100644 --- a/src/applications/phortune/storage/PhortuneProductTransaction.php +++ b/src/applications/phortune/storage/PhortuneProductTransaction.php @@ -19,10 +19,6 @@ final class PhortuneProductTransaction return null; } - public function getApplicationObjectTypeName() { - return pht('product'); - } - public function getTitle() { $author_phid = $this->getAuthorPHID(); diff --git a/src/applications/ponder/storage/PonderAnswerTransaction.php b/src/applications/ponder/storage/PonderAnswerTransaction.php index d29ec89821..d8a2ff4fd0 100644 --- a/src/applications/ponder/storage/PonderAnswerTransaction.php +++ b/src/applications/ponder/storage/PonderAnswerTransaction.php @@ -21,10 +21,6 @@ final class PonderAnswerTransaction return new PonderAnswerTransactionComment(); } - public function getApplicationObjectTypeName() { - return pht('answer'); - } - public function getTitleForFeed() { $author_phid = $this->getAuthorPHID(); $object_phid = $this->getObjectPHID(); diff --git a/src/applications/ponder/storage/PonderQuestionTransaction.php b/src/applications/ponder/storage/PonderQuestionTransaction.php index 5bc1c9b16e..90f509ebaa 100644 --- a/src/applications/ponder/storage/PonderQuestionTransaction.php +++ b/src/applications/ponder/storage/PonderQuestionTransaction.php @@ -24,10 +24,6 @@ final class PonderQuestionTransaction return new PonderQuestionTransactionComment(); } - public function getApplicationObjectTypeName() { - return pht('question'); - } - public function getTitle() { $author_phid = $this->getAuthorPHID(); diff --git a/src/applications/releeph/storage/ReleephBranchTransaction.php b/src/applications/releeph/storage/ReleephBranchTransaction.php index 94c4812722..d9805aff88 100644 --- a/src/applications/releeph/storage/ReleephBranchTransaction.php +++ b/src/applications/releeph/storage/ReleephBranchTransaction.php @@ -11,9 +11,5 @@ final class ReleephBranchTransaction return ReleephPHIDTypeBranch::TYPECONST; } - public function getApplicationObjectTypeName() { - return pht('branch'); - } - } diff --git a/src/applications/releeph/storage/ReleephProjectTransaction.php b/src/applications/releeph/storage/ReleephProjectTransaction.php index cbd2d23db4..fc9fd0c5c6 100644 --- a/src/applications/releeph/storage/ReleephProjectTransaction.php +++ b/src/applications/releeph/storage/ReleephProjectTransaction.php @@ -11,9 +11,5 @@ final class ReleephProjectTransaction return ReleephPHIDTypeProject::TYPECONST; } - public function getApplicationObjectTypeName() { - return pht('project'); - } - } diff --git a/src/applications/releeph/storage/ReleephRequestTransaction.php b/src/applications/releeph/storage/ReleephRequestTransaction.php index 0ad1cb6422..5a7ba969cd 100644 --- a/src/applications/releeph/storage/ReleephRequestTransaction.php +++ b/src/applications/releeph/storage/ReleephRequestTransaction.php @@ -23,10 +23,6 @@ final class ReleephRequestTransaction return new ReleephRequestTransactionComment(); } - public function getApplicationObjectTypeName() { - return pht('releeph request'); - } - public function hasChangeDetails() { switch ($this->getTransactionType()) { default; diff --git a/src/applications/repository/storage/PhabricatorRepositoryTransaction.php b/src/applications/repository/storage/PhabricatorRepositoryTransaction.php index 24d99c168c..e2ea5bd3bf 100644 --- a/src/applications/repository/storage/PhabricatorRepositoryTransaction.php +++ b/src/applications/repository/storage/PhabricatorRepositoryTransaction.php @@ -19,10 +19,6 @@ final class PhabricatorRepositoryTransaction return null; } - public function getApplicationObjectTypeName() { - return pht('repository'); - } - public function getTitle() { $author_phid = $this->getAuthorPHID(); diff --git a/src/applications/slowvote/storage/PhabricatorSlowvoteTransaction.php b/src/applications/slowvote/storage/PhabricatorSlowvoteTransaction.php index ec9f090f69..bdd04c8540 100644 --- a/src/applications/slowvote/storage/PhabricatorSlowvoteTransaction.php +++ b/src/applications/slowvote/storage/PhabricatorSlowvoteTransaction.php @@ -20,10 +20,6 @@ final class PhabricatorSlowvoteTransaction return new PhabricatorSlowvoteTransactionComment(); } - public function getApplicationObjectTypeName() { - return pht('vote'); - } - public function shouldHide() { $old = $this->getOldValue(); $new = $this->getNewValue(); diff --git a/src/applications/transactions/storage/PhabricatorApplicationTransaction.php b/src/applications/transactions/storage/PhabricatorApplicationTransaction.php index b9e348c0b5..f90d24bd94 100644 --- a/src/applications/transactions/storage/PhabricatorApplicationTransaction.php +++ b/src/applications/transactions/storage/PhabricatorApplicationTransaction.php @@ -30,7 +30,17 @@ abstract class PhabricatorApplicationTransaction private $transactionGroup = array(); abstract public function getApplicationTransactionType(); - abstract public function getApplicationObjectTypeName(); + + private function getApplicationObjectTypeName() { + $types = PhabricatorPHIDType::getAllTypes(); + + $type = idx($types, $this->getApplicationTransactionType()); + if ($type) { + return $type->getTypeName(); + } + + return pht('Object'); + } public function getApplicationTransactionCommentObject() { throw new Exception("Not implemented!"); -- 2.51.2