1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-26 16:52:41 +01:00

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
This commit is contained in:
Chad Little 2017-05-19 17:57:38 +00:00 committed by chad
parent 93e28da76e
commit d783299a19
2 changed files with 6 additions and 1 deletions

View file

@ -164,6 +164,8 @@ final class PhrictionTransactionEditor
switch ($xaction->getTransactionType()) { switch ($xaction->getTransactionType()) {
case PhrictionTransaction::TYPE_CONTENT: case PhrictionTransaction::TYPE_CONTENT:
$object->setStatus(PhrictionDocumentStatus::STATUS_EXISTS);
return;
case PhrictionTransaction::TYPE_MOVE_AWAY: case PhrictionTransaction::TYPE_MOVE_AWAY:
$object->setStatus(PhrictionDocumentStatus::STATUS_MOVED); $object->setStatus(PhrictionDocumentStatus::STATUS_MOVED);
return; return;
@ -241,10 +243,10 @@ final class PhrictionTransactionEditor
foreach ($xactions as $xaction) { foreach ($xactions as $xaction) {
switch ($xaction->getTransactionType()) { switch ($xaction->getTransactionType()) {
case PhrictionDocumentTitleTransaction::TRANSACTIONTYPE: case PhrictionDocumentTitleTransaction::TRANSACTIONTYPE:
case PhrictionDocumentMoveToTransaction::TRANSACTIONTYPE:
case PhrictionTransaction::TYPE_CONTENT: case PhrictionTransaction::TYPE_CONTENT:
case PhrictionTransaction::TYPE_DELETE: case PhrictionTransaction::TYPE_DELETE:
case PhrictionTransaction::TYPE_MOVE_AWAY: case PhrictionTransaction::TYPE_MOVE_AWAY:
case PhrictionDocumentMoveToTransaction::TRANSACTIONTYPE:
$save_content = true; $save_content = true;
break; break;
default: default:

View file

@ -14,6 +14,9 @@ final class PhrictionDocumentTitleTransaction
public function applyInternalEffects($object, $value) { public function applyInternalEffects($object, $value) {
$object->setStatus(PhrictionDocumentStatus::STATUS_EXISTS); $object->setStatus(PhrictionDocumentStatus::STATUS_EXISTS);
}
public function applyExternalEffects($object, $value) {
$this->getEditor()->getNewContent()->setTitle($value); $this->getEditor()->getNewContent()->setTitle($value);
} }