From c9889e3d55b1ee5d5bf0cc401470fb5fa7771cc3 Mon Sep 17 00:00:00 2001 From: epriestley Date: Fri, 19 May 2017 12:41:46 -0700 Subject: [PATCH] Fix an issue in Phriction where moving a document just copied it instead Summary: Ref T12732. See D17918. With modular transactions, `getCustomTransactionNewValue()` isn't actually called. Test Plan: Moved document `/x/` to `/y/`, saw document gone at `/x/` instead of copied. Reviewers: chad Reviewed By: chad Maniphest Tasks: T12732 Differential Revision: https://secure.phabricator.com/D17963 --- .../phriction/editor/PhrictionTransactionEditor.php | 10 +++++----- .../xaction/PhrictionDocumentMoveToTransaction.php | 5 ++++- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/applications/phriction/editor/PhrictionTransactionEditor.php b/src/applications/phriction/editor/PhrictionTransactionEditor.php index 1f97dd3c54..9ab91d5db9 100644 --- a/src/applications/phriction/editor/PhrictionTransactionEditor.php +++ b/src/applications/phriction/editor/PhrictionTransactionEditor.php @@ -69,6 +69,11 @@ final class PhrictionTransactionEditor return $this->processContentVersionError; } + public function setMoveAwayDocument(PhrictionDocument $document) { + $this->moveAwayDocument = $document; + return $this; + } + public function getEditorApplicationClass() { return 'PhabricatorPhrictionApplication'; } @@ -116,11 +121,6 @@ final class PhrictionTransactionEditor case PhrictionTransaction::TYPE_CONTENT: case PhrictionTransaction::TYPE_DELETE: return $xaction->getNewValue(); - case PhrictionDocumentMoveToTransaction::TRANSACTIONTYPE: - $document = $xaction->getNewValue(); - // grab the real object now for the sub-editor to come - $this->moveAwayDocument = $document; - return; case PhrictionTransaction::TYPE_MOVE_AWAY: $document = $xaction->getNewValue(); $dict = array( diff --git a/src/applications/phriction/xaction/PhrictionDocumentMoveToTransaction.php b/src/applications/phriction/xaction/PhrictionDocumentMoveToTransaction.php index a513b8fe36..a95e70ebdb 100644 --- a/src/applications/phriction/xaction/PhrictionDocumentMoveToTransaction.php +++ b/src/applications/phriction/xaction/PhrictionDocumentMoveToTransaction.php @@ -17,12 +17,15 @@ final class PhrictionDocumentMoveToTransaction 'content' => $document->getContent()->getContent(), 'title' => $document->getContent()->getTitle(), ); + + $editor = $this->getEditor(); + $editor->setMoveAwayDocument($document); + return $dict; } public function applyInternalEffects($object, $value) { $object->setStatus(PhrictionDocumentStatus::STATUS_EXISTS); - $this->getEditor()->getNewContent()->setTitle($value); } public function applyExternalEffects($object, $value) {