From 16c8d44c37c964fcd4041aa08544385e2b4d234a Mon Sep 17 00:00:00 2001 From: Bob Trahan Date: Tue, 19 May 2015 11:26:53 -0700 Subject: [PATCH] Transactions - make customization of TYPE_EDGE optional Summary: Ref T6403. This does TYPE_EDGE since I just had to deal with T8252. Look like this fixes a few editors (maybe) that would have had fatals with mentions like slowvote and ponder. Test Plan: made a phame post mentioning a task and it worked! joined / left a project, watched / unwatched a project and that worked! blind faith for other sites. Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin, epriestley Maniphest Tasks: T6403 Differential Revision: https://secure.phabricator.com/D12929 --- .../almanac/editor/AlmanacDeviceEditor.php | 2 -- .../almanac/editor/AlmanacServiceEditor.php | 2 -- .../audit/editor/PhabricatorAuditEditor.php | 2 -- .../editor/PhabricatorCalendarEventEditor.php | 2 -- ...abricatorDashboardPanelTransactionEditor.php | 3 --- .../PhabricatorDashboardTransactionEditor.php | 4 ---- .../editor/DifferentialTransactionEditor.php | 3 --- .../fund/editor/FundInitiativeEditor.php | 2 -- .../paste/editor/PhabricatorPasteEditor.php | 2 -- .../phame/editor/PhamePostEditor.php | 3 --- .../pholio/editor/PholioMockEditor.php | 4 ---- .../phortune/editor/PhortuneAccountEditor.php | 4 ---- .../phortune/editor/PhortuneMerchantEditor.php | 2 -- .../ponder/editor/PonderQuestionEditor.php | 2 -- .../PhabricatorProjectTransactionEditor.php | 17 +++++++++++++++-- .../editor/PhabricatorSlowvoteEditor.php | 2 -- .../PhabricatorApplicationTransactionEditor.php | 3 ++- 17 files changed, 17 insertions(+), 42 deletions(-) diff --git a/src/applications/almanac/editor/AlmanacDeviceEditor.php b/src/applications/almanac/editor/AlmanacDeviceEditor.php index 98f7604fb4..211788e441 100644 --- a/src/applications/almanac/editor/AlmanacDeviceEditor.php +++ b/src/applications/almanac/editor/AlmanacDeviceEditor.php @@ -57,7 +57,6 @@ final class AlmanacDeviceEditor case AlmanacDeviceTransaction::TYPE_INTERFACE: case PhabricatorTransactions::TYPE_VIEW_POLICY: case PhabricatorTransactions::TYPE_EDIT_POLICY: - case PhabricatorTransactions::TYPE_EDGE: return; } @@ -72,7 +71,6 @@ final class AlmanacDeviceEditor case AlmanacDeviceTransaction::TYPE_NAME: case PhabricatorTransactions::TYPE_VIEW_POLICY: case PhabricatorTransactions::TYPE_EDIT_POLICY: - case PhabricatorTransactions::TYPE_EDGE: return; case AlmanacDeviceTransaction::TYPE_INTERFACE: $old = $xaction->getOldValue(); diff --git a/src/applications/almanac/editor/AlmanacServiceEditor.php b/src/applications/almanac/editor/AlmanacServiceEditor.php index 65d4d03c55..928696dbcd 100644 --- a/src/applications/almanac/editor/AlmanacServiceEditor.php +++ b/src/applications/almanac/editor/AlmanacServiceEditor.php @@ -63,7 +63,6 @@ final class AlmanacServiceEditor return; case PhabricatorTransactions::TYPE_VIEW_POLICY: case PhabricatorTransactions::TYPE_EDIT_POLICY: - case PhabricatorTransactions::TYPE_EDGE: return; } @@ -78,7 +77,6 @@ final class AlmanacServiceEditor case AlmanacServiceTransaction::TYPE_NAME: case PhabricatorTransactions::TYPE_VIEW_POLICY: case PhabricatorTransactions::TYPE_EDIT_POLICY: - case PhabricatorTransactions::TYPE_EDGE: return; case AlmanacServiceTransaction::TYPE_LOCK: $service = id(new AlmanacServiceQuery()) diff --git a/src/applications/audit/editor/PhabricatorAuditEditor.php b/src/applications/audit/editor/PhabricatorAuditEditor.php index d30a4061b7..77d1d0a23a 100644 --- a/src/applications/audit/editor/PhabricatorAuditEditor.php +++ b/src/applications/audit/editor/PhabricatorAuditEditor.php @@ -117,7 +117,6 @@ final class PhabricatorAuditEditor switch ($xaction->getTransactionType()) { case PhabricatorTransactions::TYPE_COMMENT: case PhabricatorTransactions::TYPE_SUBSCRIBERS: - case PhabricatorTransactions::TYPE_EDGE: case PhabricatorAuditActionConstants::ACTION: case PhabricatorAuditActionConstants::INLINE: case PhabricatorAuditActionConstants::ADD_AUDITORS: @@ -135,7 +134,6 @@ final class PhabricatorAuditEditor switch ($xaction->getTransactionType()) { case PhabricatorTransactions::TYPE_COMMENT: case PhabricatorTransactions::TYPE_SUBSCRIBERS: - case PhabricatorTransactions::TYPE_EDGE: case PhabricatorAuditActionConstants::ACTION: case PhabricatorAuditTransaction::TYPE_COMMIT: return; diff --git a/src/applications/calendar/editor/PhabricatorCalendarEventEditor.php b/src/applications/calendar/editor/PhabricatorCalendarEventEditor.php index 727c33958f..cf6fc5936e 100644 --- a/src/applications/calendar/editor/PhabricatorCalendarEventEditor.php +++ b/src/applications/calendar/editor/PhabricatorCalendarEventEditor.php @@ -111,7 +111,6 @@ final class PhabricatorCalendarEventEditor case PhabricatorTransactions::TYPE_COMMENT: case PhabricatorTransactions::TYPE_VIEW_POLICY: case PhabricatorTransactions::TYPE_EDIT_POLICY: - case PhabricatorTransactions::TYPE_EDGE: case PhabricatorTransactions::TYPE_SUBSCRIBERS: return; } @@ -154,7 +153,6 @@ final class PhabricatorCalendarEventEditor case PhabricatorTransactions::TYPE_COMMENT: case PhabricatorTransactions::TYPE_VIEW_POLICY: case PhabricatorTransactions::TYPE_EDIT_POLICY: - case PhabricatorTransactions::TYPE_EDGE: case PhabricatorTransactions::TYPE_SUBSCRIBERS: return; } diff --git a/src/applications/dashboard/editor/PhabricatorDashboardPanelTransactionEditor.php b/src/applications/dashboard/editor/PhabricatorDashboardPanelTransactionEditor.php index 4b1ddde899..6f76e2618e 100644 --- a/src/applications/dashboard/editor/PhabricatorDashboardPanelTransactionEditor.php +++ b/src/applications/dashboard/editor/PhabricatorDashboardPanelTransactionEditor.php @@ -68,8 +68,6 @@ final class PhabricatorDashboardPanelTransactionEditor case PhabricatorTransactions::TYPE_EDIT_POLICY: $object->setEditPolicy($xaction->getNewValue()); return; - case PhabricatorTransactions::TYPE_EDGE: - return; } return parent::applyCustomInternalTransaction($object, $xaction); @@ -84,7 +82,6 @@ final class PhabricatorDashboardPanelTransactionEditor case PhabricatorDashboardPanelTransaction::TYPE_ARCHIVE: case PhabricatorTransactions::TYPE_VIEW_POLICY: case PhabricatorTransactions::TYPE_EDIT_POLICY: - case PhabricatorTransactions::TYPE_EDGE: return; } diff --git a/src/applications/dashboard/editor/PhabricatorDashboardTransactionEditor.php b/src/applications/dashboard/editor/PhabricatorDashboardTransactionEditor.php index 6942a5f89e..ed16a22a9c 100644 --- a/src/applications/dashboard/editor/PhabricatorDashboardTransactionEditor.php +++ b/src/applications/dashboard/editor/PhabricatorDashboardTransactionEditor.php @@ -115,8 +115,6 @@ final class PhabricatorDashboardTransactionEditor case PhabricatorTransactions::TYPE_EDIT_POLICY: $object->setEditPolicy($xaction->getNewValue()); return; - case PhabricatorTransactions::TYPE_EDGE: - return; } return parent::applyCustomInternalTransaction($object, $xaction); @@ -132,8 +130,6 @@ final class PhabricatorDashboardTransactionEditor case PhabricatorTransactions::TYPE_VIEW_POLICY: case PhabricatorTransactions::TYPE_EDIT_POLICY: return; - case PhabricatorTransactions::TYPE_EDGE: - return; } return parent::applyCustomExternalTransaction($object, $xaction); diff --git a/src/applications/differential/editor/DifferentialTransactionEditor.php b/src/applications/differential/editor/DifferentialTransactionEditor.php index 94889213ba..a9084093f6 100644 --- a/src/applications/differential/editor/DifferentialTransactionEditor.php +++ b/src/applications/differential/editor/DifferentialTransactionEditor.php @@ -199,8 +199,6 @@ final class DifferentialTransactionEditor case PhabricatorTransactions::TYPE_COMMENT: case DifferentialTransaction::TYPE_INLINE: return; - case PhabricatorTransactions::TYPE_EDGE: - return; case DifferentialTransaction::TYPE_UPDATE: if (!$this->getIsCloseByCommit()) { switch ($object->getStatus()) { @@ -581,7 +579,6 @@ final class DifferentialTransactionEditor case PhabricatorTransactions::TYPE_EDIT_POLICY: return; case PhabricatorTransactions::TYPE_SUBSCRIBERS: - case PhabricatorTransactions::TYPE_EDGE: case PhabricatorTransactions::TYPE_COMMENT: case DifferentialTransaction::TYPE_ACTION: return; diff --git a/src/applications/fund/editor/FundInitiativeEditor.php b/src/applications/fund/editor/FundInitiativeEditor.php index 05041ba119..33ad1017d0 100644 --- a/src/applications/fund/editor/FundInitiativeEditor.php +++ b/src/applications/fund/editor/FundInitiativeEditor.php @@ -103,7 +103,6 @@ final class FundInitiativeEditor $object->setTotalAsCurrency($total); return; case PhabricatorTransactions::TYPE_SUBSCRIBERS: - case PhabricatorTransactions::TYPE_EDGE: case PhabricatorTransactions::TYPE_VIEW_POLICY: case PhabricatorTransactions::TYPE_EDIT_POLICY: return; @@ -157,7 +156,6 @@ final class FundInitiativeEditor $editor->applyTransactions($backer, $subx); return; case PhabricatorTransactions::TYPE_SUBSCRIBERS: - case PhabricatorTransactions::TYPE_EDGE: case PhabricatorTransactions::TYPE_VIEW_POLICY: case PhabricatorTransactions::TYPE_EDIT_POLICY: return; diff --git a/src/applications/paste/editor/PhabricatorPasteEditor.php b/src/applications/paste/editor/PhabricatorPasteEditor.php index 45e4998d99..86f2eea393 100644 --- a/src/applications/paste/editor/PhabricatorPasteEditor.php +++ b/src/applications/paste/editor/PhabricatorPasteEditor.php @@ -90,7 +90,6 @@ final class PhabricatorPasteEditor return; case PhabricatorTransactions::TYPE_COMMENT: case PhabricatorTransactions::TYPE_SUBSCRIBERS: - case PhabricatorTransactions::TYPE_EDGE: return; } @@ -109,7 +108,6 @@ final class PhabricatorPasteEditor case PhabricatorTransactions::TYPE_EDIT_POLICY: case PhabricatorTransactions::TYPE_COMMENT: case PhabricatorTransactions::TYPE_SUBSCRIBERS: - case PhabricatorTransactions::TYPE_EDGE: return; } diff --git a/src/applications/phame/editor/PhamePostEditor.php b/src/applications/phame/editor/PhamePostEditor.php index c08ad2b155..ef6cd21307 100644 --- a/src/applications/phame/editor/PhamePostEditor.php +++ b/src/applications/phame/editor/PhamePostEditor.php @@ -64,8 +64,6 @@ final class PhamePostEditor return $object->setBody($xaction->getNewValue()); case PhamePostTransaction::TYPE_COMMENTS_WIDGET: return $object->setCommentsWidget($xaction->getNewValue()); - case PhabricatorTransactions::TYPE_EDGE: - return; } return parent::applyCustomInternalTransaction($object, $xaction); @@ -80,7 +78,6 @@ final class PhamePostEditor case PhamePostTransaction::TYPE_PHAME_TITLE: case PhamePostTransaction::TYPE_BODY: case PhamePostTransaction::TYPE_COMMENTS_WIDGET: - case PhabricatorTransactions::TYPE_EDGE: return; } diff --git a/src/applications/pholio/editor/PholioMockEditor.php b/src/applications/pholio/editor/PholioMockEditor.php index 7ba95455b5..cd36b563b3 100644 --- a/src/applications/pholio/editor/PholioMockEditor.php +++ b/src/applications/pholio/editor/PholioMockEditor.php @@ -209,8 +209,6 @@ final class PholioMockEditor extends PhabricatorApplicationTransactionEditor { case PholioTransactionType::TYPE_STATUS: $object->setStatus($xaction->getNewValue()); break; - case PhabricatorTransactions::TYPE_EDGE: - return; } } @@ -278,8 +276,6 @@ final class PholioMockEditor extends PhabricatorApplicationTransactionEditor { $image->setSequence($value); $image->save(); break; - case PhabricatorTransactions::TYPE_EDGE: - return; } } diff --git a/src/applications/phortune/editor/PhortuneAccountEditor.php b/src/applications/phortune/editor/PhortuneAccountEditor.php index 2c1186dafb..556df99fbf 100644 --- a/src/applications/phortune/editor/PhortuneAccountEditor.php +++ b/src/applications/phortune/editor/PhortuneAccountEditor.php @@ -49,8 +49,6 @@ final class PhortuneAccountEditor case PhortuneAccountTransaction::TYPE_NAME: $object->setName($xaction->getNewValue()); return; - case PhabricatorTransactions::TYPE_EDGE: - return; } return parent::applyCustomInternalTransaction($object, $xaction); } @@ -61,8 +59,6 @@ final class PhortuneAccountEditor switch ($xaction->getTransactionType()) { case PhortuneAccountTransaction::TYPE_NAME: return; - case PhabricatorTransactions::TYPE_EDGE: - return; } return parent::applyCustomExternalTransaction($object, $xaction); } diff --git a/src/applications/phortune/editor/PhortuneMerchantEditor.php b/src/applications/phortune/editor/PhortuneMerchantEditor.php index 432efe0886..ae8c1fda54 100644 --- a/src/applications/phortune/editor/PhortuneMerchantEditor.php +++ b/src/applications/phortune/editor/PhortuneMerchantEditor.php @@ -59,7 +59,6 @@ final class PhortuneMerchantEditor case PhortuneMerchantTransaction::TYPE_DESCRIPTION: $object->setDescription($xaction->getNewValue()); return; - case PhabricatorTransactions::TYPE_EDGE: case PhabricatorTransactions::TYPE_VIEW_POLICY: return; } @@ -74,7 +73,6 @@ final class PhortuneMerchantEditor switch ($xaction->getTransactionType()) { case PhortuneMerchantTransaction::TYPE_NAME: case PhortuneMerchantTransaction::TYPE_DESCRIPTION: - case PhabricatorTransactions::TYPE_EDGE: case PhabricatorTransactions::TYPE_VIEW_POLICY: return; } diff --git a/src/applications/ponder/editor/PonderQuestionEditor.php b/src/applications/ponder/editor/PonderQuestionEditor.php index 5505e751de..9dbe58cb0e 100644 --- a/src/applications/ponder/editor/PonderQuestionEditor.php +++ b/src/applications/ponder/editor/PonderQuestionEditor.php @@ -145,8 +145,6 @@ final class PonderQuestionEditor $object->setAnswerCount($count); break; - case PhabricatorTransactions::TYPE_EDGE: - return; } } diff --git a/src/applications/project/editor/PhabricatorProjectTransactionEditor.php b/src/applications/project/editor/PhabricatorProjectTransactionEditor.php index 502623685c..84ca63a358 100644 --- a/src/applications/project/editor/PhabricatorProjectTransactionEditor.php +++ b/src/applications/project/editor/PhabricatorProjectTransactionEditor.php @@ -103,7 +103,6 @@ final class PhabricatorProjectTransactionEditor $object->setIsMembershipLocked($xaction->getNewValue()); return; case PhabricatorTransactions::TYPE_SUBSCRIBERS: - case PhabricatorTransactions::TYPE_EDGE: return; case PhabricatorTransactions::TYPE_VIEW_POLICY: $object->setViewPolicy($xaction->getNewValue()); @@ -170,6 +169,20 @@ final class PhabricatorProjectTransactionEditor case PhabricatorProjectTransaction::TYPE_COLOR: case PhabricatorProjectTransaction::TYPE_LOCKED: return; + } + + return parent::applyCustomExternalTransaction($object, $xaction); + } + + protected function applyBuiltinExternalTransaction( + PhabricatorLiskDAO $object, + PhabricatorApplicationTransaction $xaction) { + + $old = $xaction->getOldValue(); + $new = $xaction->getNewValue(); + + switch ($xaction->getTransactionType()) { + case PhabricatorTransactions::TYPE_EDGE: $edge_type = $xaction->getMetadataValue('edge:type'); switch ($edge_type) { @@ -225,7 +238,7 @@ final class PhabricatorProjectTransactionEditor return; } - return parent::applyCustomExternalTransaction($object, $xaction); + return parent::applyBuiltinExternalTransaction($object, $xaction); } protected function validateTransaction( diff --git a/src/applications/slowvote/editor/PhabricatorSlowvoteEditor.php b/src/applications/slowvote/editor/PhabricatorSlowvoteEditor.php index 1ca1361436..d1bd6c18f0 100644 --- a/src/applications/slowvote/editor/PhabricatorSlowvoteEditor.php +++ b/src/applications/slowvote/editor/PhabricatorSlowvoteEditor.php @@ -102,8 +102,6 @@ final class PhabricatorSlowvoteEditor case PhabricatorSlowvoteTransaction::TYPE_CLOSE: $object->setIsClosed((int)$xaction->getNewValue()); break; - case PhabricatorTransactions::TYPE_EDGE: - return; } } diff --git a/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php b/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php index 6b070efaf9..406aaeac4a 100644 --- a/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php +++ b/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php @@ -402,6 +402,7 @@ abstract class PhabricatorApplicationTransactionEditor $field = $this->getCustomFieldForTransaction($object, $xaction); return $field->applyApplicationTransactionInternalEffects($xaction); case PhabricatorTransactions::TYPE_INLINESTATE: + case PhabricatorTransactions::TYPE_EDGE: return $this->applyBuiltinInternalTransaction($object, $xaction); } @@ -493,7 +494,7 @@ abstract class PhabricatorApplicationTransactionEditor } $editor->save(); - break; + return $this->applyBuiltinExternalTransaction($object, $xaction); case PhabricatorTransactions::TYPE_CUSTOMFIELD: $field = $this->getCustomFieldForTransaction($object, $xaction); return $field->applyApplicationTransactionExternalEffects($xaction);