1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-29 17:00:59 +01:00

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
This commit is contained in:
Bob Trahan 2015-05-19 11:26:53 -07:00
parent 7bc008d0e2
commit 16c8d44c37
17 changed files with 17 additions and 42 deletions

View file

@ -57,7 +57,6 @@ final class AlmanacDeviceEditor
case AlmanacDeviceTransaction::TYPE_INTERFACE: case AlmanacDeviceTransaction::TYPE_INTERFACE:
case PhabricatorTransactions::TYPE_VIEW_POLICY: case PhabricatorTransactions::TYPE_VIEW_POLICY:
case PhabricatorTransactions::TYPE_EDIT_POLICY: case PhabricatorTransactions::TYPE_EDIT_POLICY:
case PhabricatorTransactions::TYPE_EDGE:
return; return;
} }
@ -72,7 +71,6 @@ final class AlmanacDeviceEditor
case AlmanacDeviceTransaction::TYPE_NAME: case AlmanacDeviceTransaction::TYPE_NAME:
case PhabricatorTransactions::TYPE_VIEW_POLICY: case PhabricatorTransactions::TYPE_VIEW_POLICY:
case PhabricatorTransactions::TYPE_EDIT_POLICY: case PhabricatorTransactions::TYPE_EDIT_POLICY:
case PhabricatorTransactions::TYPE_EDGE:
return; return;
case AlmanacDeviceTransaction::TYPE_INTERFACE: case AlmanacDeviceTransaction::TYPE_INTERFACE:
$old = $xaction->getOldValue(); $old = $xaction->getOldValue();

View file

@ -63,7 +63,6 @@ final class AlmanacServiceEditor
return; return;
case PhabricatorTransactions::TYPE_VIEW_POLICY: case PhabricatorTransactions::TYPE_VIEW_POLICY:
case PhabricatorTransactions::TYPE_EDIT_POLICY: case PhabricatorTransactions::TYPE_EDIT_POLICY:
case PhabricatorTransactions::TYPE_EDGE:
return; return;
} }
@ -78,7 +77,6 @@ final class AlmanacServiceEditor
case AlmanacServiceTransaction::TYPE_NAME: case AlmanacServiceTransaction::TYPE_NAME:
case PhabricatorTransactions::TYPE_VIEW_POLICY: case PhabricatorTransactions::TYPE_VIEW_POLICY:
case PhabricatorTransactions::TYPE_EDIT_POLICY: case PhabricatorTransactions::TYPE_EDIT_POLICY:
case PhabricatorTransactions::TYPE_EDGE:
return; return;
case AlmanacServiceTransaction::TYPE_LOCK: case AlmanacServiceTransaction::TYPE_LOCK:
$service = id(new AlmanacServiceQuery()) $service = id(new AlmanacServiceQuery())

View file

@ -117,7 +117,6 @@ final class PhabricatorAuditEditor
switch ($xaction->getTransactionType()) { switch ($xaction->getTransactionType()) {
case PhabricatorTransactions::TYPE_COMMENT: case PhabricatorTransactions::TYPE_COMMENT:
case PhabricatorTransactions::TYPE_SUBSCRIBERS: case PhabricatorTransactions::TYPE_SUBSCRIBERS:
case PhabricatorTransactions::TYPE_EDGE:
case PhabricatorAuditActionConstants::ACTION: case PhabricatorAuditActionConstants::ACTION:
case PhabricatorAuditActionConstants::INLINE: case PhabricatorAuditActionConstants::INLINE:
case PhabricatorAuditActionConstants::ADD_AUDITORS: case PhabricatorAuditActionConstants::ADD_AUDITORS:
@ -135,7 +134,6 @@ final class PhabricatorAuditEditor
switch ($xaction->getTransactionType()) { switch ($xaction->getTransactionType()) {
case PhabricatorTransactions::TYPE_COMMENT: case PhabricatorTransactions::TYPE_COMMENT:
case PhabricatorTransactions::TYPE_SUBSCRIBERS: case PhabricatorTransactions::TYPE_SUBSCRIBERS:
case PhabricatorTransactions::TYPE_EDGE:
case PhabricatorAuditActionConstants::ACTION: case PhabricatorAuditActionConstants::ACTION:
case PhabricatorAuditTransaction::TYPE_COMMIT: case PhabricatorAuditTransaction::TYPE_COMMIT:
return; return;

View file

@ -111,7 +111,6 @@ final class PhabricatorCalendarEventEditor
case PhabricatorTransactions::TYPE_COMMENT: case PhabricatorTransactions::TYPE_COMMENT:
case PhabricatorTransactions::TYPE_VIEW_POLICY: case PhabricatorTransactions::TYPE_VIEW_POLICY:
case PhabricatorTransactions::TYPE_EDIT_POLICY: case PhabricatorTransactions::TYPE_EDIT_POLICY:
case PhabricatorTransactions::TYPE_EDGE:
case PhabricatorTransactions::TYPE_SUBSCRIBERS: case PhabricatorTransactions::TYPE_SUBSCRIBERS:
return; return;
} }
@ -154,7 +153,6 @@ final class PhabricatorCalendarEventEditor
case PhabricatorTransactions::TYPE_COMMENT: case PhabricatorTransactions::TYPE_COMMENT:
case PhabricatorTransactions::TYPE_VIEW_POLICY: case PhabricatorTransactions::TYPE_VIEW_POLICY:
case PhabricatorTransactions::TYPE_EDIT_POLICY: case PhabricatorTransactions::TYPE_EDIT_POLICY:
case PhabricatorTransactions::TYPE_EDGE:
case PhabricatorTransactions::TYPE_SUBSCRIBERS: case PhabricatorTransactions::TYPE_SUBSCRIBERS:
return; return;
} }

View file

@ -68,8 +68,6 @@ final class PhabricatorDashboardPanelTransactionEditor
case PhabricatorTransactions::TYPE_EDIT_POLICY: case PhabricatorTransactions::TYPE_EDIT_POLICY:
$object->setEditPolicy($xaction->getNewValue()); $object->setEditPolicy($xaction->getNewValue());
return; return;
case PhabricatorTransactions::TYPE_EDGE:
return;
} }
return parent::applyCustomInternalTransaction($object, $xaction); return parent::applyCustomInternalTransaction($object, $xaction);
@ -84,7 +82,6 @@ final class PhabricatorDashboardPanelTransactionEditor
case PhabricatorDashboardPanelTransaction::TYPE_ARCHIVE: case PhabricatorDashboardPanelTransaction::TYPE_ARCHIVE:
case PhabricatorTransactions::TYPE_VIEW_POLICY: case PhabricatorTransactions::TYPE_VIEW_POLICY:
case PhabricatorTransactions::TYPE_EDIT_POLICY: case PhabricatorTransactions::TYPE_EDIT_POLICY:
case PhabricatorTransactions::TYPE_EDGE:
return; return;
} }

View file

@ -115,8 +115,6 @@ final class PhabricatorDashboardTransactionEditor
case PhabricatorTransactions::TYPE_EDIT_POLICY: case PhabricatorTransactions::TYPE_EDIT_POLICY:
$object->setEditPolicy($xaction->getNewValue()); $object->setEditPolicy($xaction->getNewValue());
return; return;
case PhabricatorTransactions::TYPE_EDGE:
return;
} }
return parent::applyCustomInternalTransaction($object, $xaction); return parent::applyCustomInternalTransaction($object, $xaction);
@ -132,8 +130,6 @@ final class PhabricatorDashboardTransactionEditor
case PhabricatorTransactions::TYPE_VIEW_POLICY: case PhabricatorTransactions::TYPE_VIEW_POLICY:
case PhabricatorTransactions::TYPE_EDIT_POLICY: case PhabricatorTransactions::TYPE_EDIT_POLICY:
return; return;
case PhabricatorTransactions::TYPE_EDGE:
return;
} }
return parent::applyCustomExternalTransaction($object, $xaction); return parent::applyCustomExternalTransaction($object, $xaction);

View file

@ -199,8 +199,6 @@ final class DifferentialTransactionEditor
case PhabricatorTransactions::TYPE_COMMENT: case PhabricatorTransactions::TYPE_COMMENT:
case DifferentialTransaction::TYPE_INLINE: case DifferentialTransaction::TYPE_INLINE:
return; return;
case PhabricatorTransactions::TYPE_EDGE:
return;
case DifferentialTransaction::TYPE_UPDATE: case DifferentialTransaction::TYPE_UPDATE:
if (!$this->getIsCloseByCommit()) { if (!$this->getIsCloseByCommit()) {
switch ($object->getStatus()) { switch ($object->getStatus()) {
@ -581,7 +579,6 @@ final class DifferentialTransactionEditor
case PhabricatorTransactions::TYPE_EDIT_POLICY: case PhabricatorTransactions::TYPE_EDIT_POLICY:
return; return;
case PhabricatorTransactions::TYPE_SUBSCRIBERS: case PhabricatorTransactions::TYPE_SUBSCRIBERS:
case PhabricatorTransactions::TYPE_EDGE:
case PhabricatorTransactions::TYPE_COMMENT: case PhabricatorTransactions::TYPE_COMMENT:
case DifferentialTransaction::TYPE_ACTION: case DifferentialTransaction::TYPE_ACTION:
return; return;

View file

@ -103,7 +103,6 @@ final class FundInitiativeEditor
$object->setTotalAsCurrency($total); $object->setTotalAsCurrency($total);
return; return;
case PhabricatorTransactions::TYPE_SUBSCRIBERS: case PhabricatorTransactions::TYPE_SUBSCRIBERS:
case PhabricatorTransactions::TYPE_EDGE:
case PhabricatorTransactions::TYPE_VIEW_POLICY: case PhabricatorTransactions::TYPE_VIEW_POLICY:
case PhabricatorTransactions::TYPE_EDIT_POLICY: case PhabricatorTransactions::TYPE_EDIT_POLICY:
return; return;
@ -157,7 +156,6 @@ final class FundInitiativeEditor
$editor->applyTransactions($backer, $subx); $editor->applyTransactions($backer, $subx);
return; return;
case PhabricatorTransactions::TYPE_SUBSCRIBERS: case PhabricatorTransactions::TYPE_SUBSCRIBERS:
case PhabricatorTransactions::TYPE_EDGE:
case PhabricatorTransactions::TYPE_VIEW_POLICY: case PhabricatorTransactions::TYPE_VIEW_POLICY:
case PhabricatorTransactions::TYPE_EDIT_POLICY: case PhabricatorTransactions::TYPE_EDIT_POLICY:
return; return;

View file

@ -90,7 +90,6 @@ final class PhabricatorPasteEditor
return; return;
case PhabricatorTransactions::TYPE_COMMENT: case PhabricatorTransactions::TYPE_COMMENT:
case PhabricatorTransactions::TYPE_SUBSCRIBERS: case PhabricatorTransactions::TYPE_SUBSCRIBERS:
case PhabricatorTransactions::TYPE_EDGE:
return; return;
} }
@ -109,7 +108,6 @@ final class PhabricatorPasteEditor
case PhabricatorTransactions::TYPE_EDIT_POLICY: case PhabricatorTransactions::TYPE_EDIT_POLICY:
case PhabricatorTransactions::TYPE_COMMENT: case PhabricatorTransactions::TYPE_COMMENT:
case PhabricatorTransactions::TYPE_SUBSCRIBERS: case PhabricatorTransactions::TYPE_SUBSCRIBERS:
case PhabricatorTransactions::TYPE_EDGE:
return; return;
} }

View file

@ -64,8 +64,6 @@ final class PhamePostEditor
return $object->setBody($xaction->getNewValue()); return $object->setBody($xaction->getNewValue());
case PhamePostTransaction::TYPE_COMMENTS_WIDGET: case PhamePostTransaction::TYPE_COMMENTS_WIDGET:
return $object->setCommentsWidget($xaction->getNewValue()); return $object->setCommentsWidget($xaction->getNewValue());
case PhabricatorTransactions::TYPE_EDGE:
return;
} }
return parent::applyCustomInternalTransaction($object, $xaction); return parent::applyCustomInternalTransaction($object, $xaction);
@ -80,7 +78,6 @@ final class PhamePostEditor
case PhamePostTransaction::TYPE_PHAME_TITLE: case PhamePostTransaction::TYPE_PHAME_TITLE:
case PhamePostTransaction::TYPE_BODY: case PhamePostTransaction::TYPE_BODY:
case PhamePostTransaction::TYPE_COMMENTS_WIDGET: case PhamePostTransaction::TYPE_COMMENTS_WIDGET:
case PhabricatorTransactions::TYPE_EDGE:
return; return;
} }

View file

@ -209,8 +209,6 @@ final class PholioMockEditor extends PhabricatorApplicationTransactionEditor {
case PholioTransactionType::TYPE_STATUS: case PholioTransactionType::TYPE_STATUS:
$object->setStatus($xaction->getNewValue()); $object->setStatus($xaction->getNewValue());
break; break;
case PhabricatorTransactions::TYPE_EDGE:
return;
} }
} }
@ -278,8 +276,6 @@ final class PholioMockEditor extends PhabricatorApplicationTransactionEditor {
$image->setSequence($value); $image->setSequence($value);
$image->save(); $image->save();
break; break;
case PhabricatorTransactions::TYPE_EDGE:
return;
} }
} }

View file

@ -49,8 +49,6 @@ final class PhortuneAccountEditor
case PhortuneAccountTransaction::TYPE_NAME: case PhortuneAccountTransaction::TYPE_NAME:
$object->setName($xaction->getNewValue()); $object->setName($xaction->getNewValue());
return; return;
case PhabricatorTransactions::TYPE_EDGE:
return;
} }
return parent::applyCustomInternalTransaction($object, $xaction); return parent::applyCustomInternalTransaction($object, $xaction);
} }
@ -61,8 +59,6 @@ final class PhortuneAccountEditor
switch ($xaction->getTransactionType()) { switch ($xaction->getTransactionType()) {
case PhortuneAccountTransaction::TYPE_NAME: case PhortuneAccountTransaction::TYPE_NAME:
return; return;
case PhabricatorTransactions::TYPE_EDGE:
return;
} }
return parent::applyCustomExternalTransaction($object, $xaction); return parent::applyCustomExternalTransaction($object, $xaction);
} }

View file

@ -59,7 +59,6 @@ final class PhortuneMerchantEditor
case PhortuneMerchantTransaction::TYPE_DESCRIPTION: case PhortuneMerchantTransaction::TYPE_DESCRIPTION:
$object->setDescription($xaction->getNewValue()); $object->setDescription($xaction->getNewValue());
return; return;
case PhabricatorTransactions::TYPE_EDGE:
case PhabricatorTransactions::TYPE_VIEW_POLICY: case PhabricatorTransactions::TYPE_VIEW_POLICY:
return; return;
} }
@ -74,7 +73,6 @@ final class PhortuneMerchantEditor
switch ($xaction->getTransactionType()) { switch ($xaction->getTransactionType()) {
case PhortuneMerchantTransaction::TYPE_NAME: case PhortuneMerchantTransaction::TYPE_NAME:
case PhortuneMerchantTransaction::TYPE_DESCRIPTION: case PhortuneMerchantTransaction::TYPE_DESCRIPTION:
case PhabricatorTransactions::TYPE_EDGE:
case PhabricatorTransactions::TYPE_VIEW_POLICY: case PhabricatorTransactions::TYPE_VIEW_POLICY:
return; return;
} }

View file

@ -145,8 +145,6 @@ final class PonderQuestionEditor
$object->setAnswerCount($count); $object->setAnswerCount($count);
break; break;
case PhabricatorTransactions::TYPE_EDGE:
return;
} }
} }

View file

@ -103,7 +103,6 @@ final class PhabricatorProjectTransactionEditor
$object->setIsMembershipLocked($xaction->getNewValue()); $object->setIsMembershipLocked($xaction->getNewValue());
return; return;
case PhabricatorTransactions::TYPE_SUBSCRIBERS: case PhabricatorTransactions::TYPE_SUBSCRIBERS:
case PhabricatorTransactions::TYPE_EDGE:
return; return;
case PhabricatorTransactions::TYPE_VIEW_POLICY: case PhabricatorTransactions::TYPE_VIEW_POLICY:
$object->setViewPolicy($xaction->getNewValue()); $object->setViewPolicy($xaction->getNewValue());
@ -170,6 +169,20 @@ final class PhabricatorProjectTransactionEditor
case PhabricatorProjectTransaction::TYPE_COLOR: case PhabricatorProjectTransaction::TYPE_COLOR:
case PhabricatorProjectTransaction::TYPE_LOCKED: case PhabricatorProjectTransaction::TYPE_LOCKED:
return; 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: case PhabricatorTransactions::TYPE_EDGE:
$edge_type = $xaction->getMetadataValue('edge:type'); $edge_type = $xaction->getMetadataValue('edge:type');
switch ($edge_type) { switch ($edge_type) {
@ -225,7 +238,7 @@ final class PhabricatorProjectTransactionEditor
return; return;
} }
return parent::applyCustomExternalTransaction($object, $xaction); return parent::applyBuiltinExternalTransaction($object, $xaction);
} }
protected function validateTransaction( protected function validateTransaction(

View file

@ -102,8 +102,6 @@ final class PhabricatorSlowvoteEditor
case PhabricatorSlowvoteTransaction::TYPE_CLOSE: case PhabricatorSlowvoteTransaction::TYPE_CLOSE:
$object->setIsClosed((int)$xaction->getNewValue()); $object->setIsClosed((int)$xaction->getNewValue());
break; break;
case PhabricatorTransactions::TYPE_EDGE:
return;
} }
} }

View file

@ -402,6 +402,7 @@ abstract class PhabricatorApplicationTransactionEditor
$field = $this->getCustomFieldForTransaction($object, $xaction); $field = $this->getCustomFieldForTransaction($object, $xaction);
return $field->applyApplicationTransactionInternalEffects($xaction); return $field->applyApplicationTransactionInternalEffects($xaction);
case PhabricatorTransactions::TYPE_INLINESTATE: case PhabricatorTransactions::TYPE_INLINESTATE:
case PhabricatorTransactions::TYPE_EDGE:
return $this->applyBuiltinInternalTransaction($object, $xaction); return $this->applyBuiltinInternalTransaction($object, $xaction);
} }
@ -493,7 +494,7 @@ abstract class PhabricatorApplicationTransactionEditor
} }
$editor->save(); $editor->save();
break; return $this->applyBuiltinExternalTransaction($object, $xaction);
case PhabricatorTransactions::TYPE_CUSTOMFIELD: case PhabricatorTransactions::TYPE_CUSTOMFIELD:
$field = $this->getCustomFieldForTransaction($object, $xaction); $field = $this->getCustomFieldForTransaction($object, $xaction);
return $field->applyApplicationTransactionExternalEffects($xaction); return $field->applyApplicationTransactionExternalEffects($xaction);