From d783299a19c536d79bc4e73a5b1f6c1942ad2d05 Mon Sep 17 00:00:00 2001 From: Chad Little Date: Fri, 19 May 2017 17:57:38 +0000 Subject: [PATCH] Fix Phriction status not set property on new document Summary: I deleted too many lines of code here and TYPE_MOVE was always being applied when CONTENT was set. This should fix on next document save, but should I write some migration tool anyways? Test Plan: Create a new document, see document with correct status. Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin Differential Revision: https://secure.phabricator.com/D17960 --- .../phriction/editor/PhrictionTransactionEditor.php | 4 +++- .../phriction/xaction/PhrictionDocumentTitleTransaction.php | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/applications/phriction/editor/PhrictionTransactionEditor.php b/src/applications/phriction/editor/PhrictionTransactionEditor.php index cbe6e426d0..1f97dd3c54 100644 --- a/src/applications/phriction/editor/PhrictionTransactionEditor.php +++ b/src/applications/phriction/editor/PhrictionTransactionEditor.php @@ -164,6 +164,8 @@ final class PhrictionTransactionEditor switch ($xaction->getTransactionType()) { case PhrictionTransaction::TYPE_CONTENT: + $object->setStatus(PhrictionDocumentStatus::STATUS_EXISTS); + return; case PhrictionTransaction::TYPE_MOVE_AWAY: $object->setStatus(PhrictionDocumentStatus::STATUS_MOVED); return; @@ -241,10 +243,10 @@ final class PhrictionTransactionEditor foreach ($xactions as $xaction) { switch ($xaction->getTransactionType()) { case PhrictionDocumentTitleTransaction::TRANSACTIONTYPE: + case PhrictionDocumentMoveToTransaction::TRANSACTIONTYPE: case PhrictionTransaction::TYPE_CONTENT: case PhrictionTransaction::TYPE_DELETE: case PhrictionTransaction::TYPE_MOVE_AWAY: - case PhrictionDocumentMoveToTransaction::TRANSACTIONTYPE: $save_content = true; break; default: diff --git a/src/applications/phriction/xaction/PhrictionDocumentTitleTransaction.php b/src/applications/phriction/xaction/PhrictionDocumentTitleTransaction.php index 730b062f34..4f1ba850a7 100644 --- a/src/applications/phriction/xaction/PhrictionDocumentTitleTransaction.php +++ b/src/applications/phriction/xaction/PhrictionDocumentTitleTransaction.php @@ -14,6 +14,9 @@ final class PhrictionDocumentTitleTransaction public function applyInternalEffects($object, $value) { $object->setStatus(PhrictionDocumentStatus::STATUS_EXISTS); + } + + public function applyExternalEffects($object, $value) { $this->getEditor()->getNewContent()->setTitle($value); }