From 01a8ba5a9798fcf7f1136885da388e97b8653fdb Mon Sep 17 00:00:00 2001 From: Bob Trahan Date: Tue, 19 May 2015 12:33:55 -0700 Subject: [PATCH] Transactions - make TYPE_COMMENT implementation optional Summary: Ref T6403. Conpherence keeps track of comments for message counts so we needed some special attention there. Otherwise, straight-forward. Test Plan: left a comment on a diff with inline comments. sent messages in conpherence successfully. verified unread count incremented correctly for sent messages for users. Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin, epriestley Maniphest Tasks: T6403 Differential Revision: https://secure.phabricator.com/D12932 --- .../audit/editor/PhabricatorAuditEditor.php | 2 -- .../editor/PhabricatorCalendarEventEditor.php | 2 -- .../conpherence/editor/ConpherenceEditor.php | 16 +++++++++++++--- .../editor/DifferentialTransactionEditor.php | 2 -- .../paste/editor/PhabricatorPasteEditor.php | 3 --- .../PhabricatorApplicationTransactionEditor.php | 2 ++ 6 files changed, 15 insertions(+), 12 deletions(-) diff --git a/src/applications/audit/editor/PhabricatorAuditEditor.php b/src/applications/audit/editor/PhabricatorAuditEditor.php index f3e7bdebb0..c628286a92 100644 --- a/src/applications/audit/editor/PhabricatorAuditEditor.php +++ b/src/applications/audit/editor/PhabricatorAuditEditor.php @@ -115,7 +115,6 @@ final class PhabricatorAuditEditor PhabricatorApplicationTransaction $xaction) { switch ($xaction->getTransactionType()) { - case PhabricatorTransactions::TYPE_COMMENT: case PhabricatorAuditActionConstants::ACTION: case PhabricatorAuditActionConstants::INLINE: case PhabricatorAuditActionConstants::ADD_AUDITORS: @@ -131,7 +130,6 @@ final class PhabricatorAuditEditor PhabricatorApplicationTransaction $xaction) { switch ($xaction->getTransactionType()) { - case PhabricatorTransactions::TYPE_COMMENT: 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 3e3b68d08f..bb4c772012 100644 --- a/src/applications/calendar/editor/PhabricatorCalendarEventEditor.php +++ b/src/applications/calendar/editor/PhabricatorCalendarEventEditor.php @@ -108,7 +108,6 @@ final class PhabricatorCalendarEventEditor $object->setIsAllDay((int)$xaction->getNewValue()); return; case PhabricatorCalendarEventTransaction::TYPE_INVITE: - case PhabricatorTransactions::TYPE_COMMENT: case PhabricatorTransactions::TYPE_VIEW_POLICY: case PhabricatorTransactions::TYPE_EDIT_POLICY: return; @@ -149,7 +148,6 @@ final class PhabricatorCalendarEventEditor } $object->attachInvitees($invitees); return; - case PhabricatorTransactions::TYPE_COMMENT: case PhabricatorTransactions::TYPE_VIEW_POLICY: case PhabricatorTransactions::TYPE_EDIT_POLICY: return; diff --git a/src/applications/conpherence/editor/ConpherenceEditor.php b/src/applications/conpherence/editor/ConpherenceEditor.php index ef68c2cff8..d44ebf912b 100644 --- a/src/applications/conpherence/editor/ConpherenceEditor.php +++ b/src/applications/conpherence/editor/ConpherenceEditor.php @@ -247,9 +247,6 @@ final class ConpherenceEditor extends PhabricatorApplicationTransactionEditor { $make_author_recent_participant = true; switch ($xaction->getTransactionType()) { - case PhabricatorTransactions::TYPE_COMMENT: - $object->setMessageCount((int)$object->getMessageCount() + 1); - break; case ConpherenceTransactionType::TYPE_TITLE: $object->setTitle($xaction->getNewValue()); break; @@ -296,6 +293,19 @@ final class ConpherenceEditor extends PhabricatorApplicationTransactionEditor { } } + protected function applyBuiltinInternalTransaction( + PhabricatorLiskDAO $object, + PhabricatorApplicationTransaction $xaction) { + + switch ($xaction->getTransactionType()) { + case PhabricatorTransactions::TYPE_COMMENT: + $object->setMessageCount((int)$object->getMessageCount() + 1); + break; + } + + return parent::applyBuiltinInternalTransaction($object, $xaction); + } + private function makeAuthorMostRecentParticipant( PhabricatorLiskDAO $object, PhabricatorApplicationTransaction $xaction) { diff --git a/src/applications/differential/editor/DifferentialTransactionEditor.php b/src/applications/differential/editor/DifferentialTransactionEditor.php index 24ffbb9031..4534123b24 100644 --- a/src/applications/differential/editor/DifferentialTransactionEditor.php +++ b/src/applications/differential/editor/DifferentialTransactionEditor.php @@ -195,7 +195,6 @@ final class DifferentialTransactionEditor case PhabricatorTransactions::TYPE_EDIT_POLICY: $object->setEditPolicy($xaction->getNewValue()); return; - case PhabricatorTransactions::TYPE_COMMENT: case DifferentialTransaction::TYPE_INLINE: return; case DifferentialTransaction::TYPE_UPDATE: @@ -577,7 +576,6 @@ final class DifferentialTransactionEditor case PhabricatorTransactions::TYPE_VIEW_POLICY: case PhabricatorTransactions::TYPE_EDIT_POLICY: return; - case PhabricatorTransactions::TYPE_COMMENT: case DifferentialTransaction::TYPE_ACTION: return; case DifferentialTransaction::TYPE_INLINE: diff --git a/src/applications/paste/editor/PhabricatorPasteEditor.php b/src/applications/paste/editor/PhabricatorPasteEditor.php index 0d64017421..7e6a18db44 100644 --- a/src/applications/paste/editor/PhabricatorPasteEditor.php +++ b/src/applications/paste/editor/PhabricatorPasteEditor.php @@ -88,8 +88,6 @@ final class PhabricatorPasteEditor case PhabricatorTransactions::TYPE_EDIT_POLICY: $object->setEditPolicy($xaction->getNewValue()); return; - case PhabricatorTransactions::TYPE_COMMENT: - return; } return parent::applyCustomInternalTransaction($object, $xaction); @@ -105,7 +103,6 @@ final class PhabricatorPasteEditor case PhabricatorPasteTransaction::TYPE_LANGUAGE: case PhabricatorTransactions::TYPE_VIEW_POLICY: case PhabricatorTransactions::TYPE_EDIT_POLICY: - case PhabricatorTransactions::TYPE_COMMENT: return; } diff --git a/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php b/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php index 11c11e1cc9..486a20a918 100644 --- a/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php +++ b/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php @@ -404,6 +404,7 @@ abstract class PhabricatorApplicationTransactionEditor case PhabricatorTransactions::TYPE_SUBSCRIBERS: case PhabricatorTransactions::TYPE_INLINESTATE: case PhabricatorTransactions::TYPE_EDGE: + case PhabricatorTransactions::TYPE_COMMENT: return $this->applyBuiltinInternalTransaction($object, $xaction); } @@ -500,6 +501,7 @@ abstract class PhabricatorApplicationTransactionEditor $field = $this->getCustomFieldForTransaction($object, $xaction); return $field->applyApplicationTransactionExternalEffects($xaction); case PhabricatorTransactions::TYPE_INLINESTATE: + case PhabricatorTransactions::TYPE_COMMENT: return $this->applyBuiltinExternalTransaction($object, $xaction); }