Differential D17146 Diff 41235 src/applications/differential/editor/DifferentialTransactionEditor.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/differential/editor/DifferentialTransactionEditor.php
| <?php | <?php | ||||
| final class DifferentialTransactionEditor | final class DifferentialTransactionEditor | ||||
| extends PhabricatorApplicationTransactionEditor { | extends PhabricatorApplicationTransactionEditor { | ||||
| private $changedPriorToCommitURI; | private $changedPriorToCommitURI; | ||||
| private $isCloseByCommit; | private $isCloseByCommit; | ||||
| private $repositoryPHIDOverride = false; | private $repositoryPHIDOverride = false; | ||||
| private $didExpandInlineState = false; | private $didExpandInlineState = false; | ||||
| private $hasReviewTransaction = false; | |||||
| private $affectedPaths; | private $affectedPaths; | ||||
| public function getEditorApplicationClass() { | public function getEditorApplicationClass() { | ||||
| return 'PhabricatorDifferentialApplication'; | return 'PhabricatorDifferentialApplication'; | ||||
| } | } | ||||
| public function getEditorObjectsDescription() { | public function getEditorObjectsDescription() { | ||||
| return pht('Differential Revisions'); | return pht('Differential Revisions'); | ||||
| ▲ Show 20 Lines • Show All 238 Lines • ▼ Show 20 Lines | protected function applyCustomInternalTransaction( | ||||
| return parent::applyCustomInternalTransaction($object, $xaction); | return parent::applyCustomInternalTransaction($object, $xaction); | ||||
| } | } | ||||
| protected function expandTransactions( | protected function expandTransactions( | ||||
| PhabricatorLiskDAO $object, | PhabricatorLiskDAO $object, | ||||
| array $xactions) { | array $xactions) { | ||||
| // If we have an "Inline State" transaction already, the caller built it | |||||
| // for us so we don't need to expand it again. | |||||
| foreach ($xactions as $xaction) { | foreach ($xactions as $xaction) { | ||||
| switch ($xaction->getTransactionType()) { | switch ($xaction->getTransactionType()) { | ||||
| case PhabricatorTransactions::TYPE_INLINESTATE: | case PhabricatorTransactions::TYPE_INLINESTATE: | ||||
| // If we have an "Inline State" transaction already, the caller | |||||
| // built it for us so we don't need to expand it again. | |||||
| $this->didExpandInlineState = true; | $this->didExpandInlineState = true; | ||||
| break; | break; | ||||
| case DifferentialRevisionAcceptTransaction::TRANSACTIONTYPE: | |||||
| case DifferentialRevisionRejectTransaction::TRANSACTIONTYPE: | |||||
| case DifferentialRevisionResignTransaction::TRANSACTIONTYPE: | |||||
| // If we have a review transaction, we'll skip marking the user | |||||
| // as "Commented" later. This should get cleaner after T10967. | |||||
| $this->hasReviewTransaction = true; | |||||
| break; | |||||
| } | } | ||||
| } | } | ||||
| return parent::expandTransactions($object, $xactions); | return parent::expandTransactions($object, $xactions); | ||||
| } | } | ||||
| protected function expandTransaction( | protected function expandTransaction( | ||||
| PhabricatorLiskDAO $object, | PhabricatorLiskDAO $object, | ||||
| ▲ Show 20 Lines • Show All 142 Lines • ▼ Show 20 Lines | switch ($xaction->getTransactionType()) { | ||||
| } | } | ||||
| break; | break; | ||||
| case PhabricatorTransactions::TYPE_COMMENT: | case PhabricatorTransactions::TYPE_COMMENT: | ||||
| // When a user leaves a comment, upgrade their reviewer status from | // When a user leaves a comment, upgrade their reviewer status from | ||||
| // "added" to "commented" if they're also a reviewer. We may further | // "added" to "commented" if they're also a reviewer. We may further | ||||
| // upgrade this based on other actions in the transaction group. | // upgrade this based on other actions in the transaction group. | ||||
| if ($this->hasReviewTransaction) { | |||||
| // If we're also applying a review transaction, skip this. | |||||
| break; | |||||
| } | |||||
| $status_added = DifferentialReviewerStatus::STATUS_ADDED; | $status_added = DifferentialReviewerStatus::STATUS_ADDED; | ||||
| $status_commented = DifferentialReviewerStatus::STATUS_COMMENTED; | $status_commented = DifferentialReviewerStatus::STATUS_COMMENTED; | ||||
| $data = array( | $data = array( | ||||
| 'status' => $status_commented, | 'status' => $status_commented, | ||||
| ); | ); | ||||
| $edits = array(); | $edits = array(); | ||||
| ▲ Show 20 Lines • Show All 1,527 Lines • Show Last 20 Lines | |||||