diff --git a/src/applications/phriction/controller/PhrictionEditController.php b/src/applications/phriction/controller/PhrictionEditController.php index fa520d5ce5..9a9e0678e8 100644 --- a/src/applications/phriction/controller/PhrictionEditController.php +++ b/src/applications/phriction/controller/PhrictionEditController.php @@ -156,10 +156,12 @@ final class PhrictionEditController return id(new AphrontRedirectResponse())->setURI($uri); } catch (PhabricatorApplicationTransactionValidationException $ex) { $validation_exception = $ex; - $e_title = $ex->getShortMessage( - PhrictionTransaction::TYPE_TITLE); - $e_content = $ex->getShortMessage( - PhrictionTransaction::TYPE_CONTENT); + $e_title = nonempty( + $ex->getShortMessage(PhrictionTransaction::TYPE_TITLE), + true); + $e_content = nonempty( + $ex->getShortMessage(PhrictionTransaction::TYPE_CONTENT), + true); // if we're not supposed to process the content version error, then // overwrite that content...! diff --git a/src/applications/phriction/editor/PhrictionTransactionEditor.php b/src/applications/phriction/editor/PhrictionTransactionEditor.php index d4059735d2..44a2436bf6 100644 --- a/src/applications/phriction/editor/PhrictionTransactionEditor.php +++ b/src/applications/phriction/editor/PhrictionTransactionEditor.php @@ -131,14 +131,16 @@ final class PhrictionTransactionEditor $dict = array( 'id' => $document->getID(), 'phid' => $document->getPHID(), - 'content' => $document->getContent()->getContent(),); + 'content' => $document->getContent()->getContent(), + 'title' => $document->getContent()->getTitle(),); return $dict; case PhrictionTransaction::TYPE_MOVE_AWAY: $document = $xaction->getNewValue(); $dict = array( 'id' => $document->getID(), 'phid' => $document->getPHID(), - 'content' => $document->getContent()->getContent(),); + 'content' => $document->getContent()->getContent(), + 'title' => $document->getContent()->getTitle(),); return $dict; } } @@ -201,7 +203,8 @@ final class PhrictionTransactionEditor if ($content === '') { $xactions[] = id(new PhrictionTransaction()) ->setTransactionType(PhrictionTransaction::TYPE_DELETE) - ->setNewValue(true); + ->setNewValue(true) + ->setMetadataValue('contentDelete', true); } break; case PhrictionTransaction::TYPE_MOVE_TO: @@ -240,6 +243,7 @@ final class PhrictionTransactionEditor case PhrictionTransaction::TYPE_MOVE_TO: $dict = $xaction->getNewValue(); $this->getNewContent()->setContent($dict['content']); + $this->getNewContent()->setTitle($dict['title']); $this->getNewContent()->setChangeType( PhrictionChangeType::CHANGE_MOVE_HERE); $this->getNewContent()->setChangeRef($dict['id']); @@ -603,7 +607,14 @@ final class PhrictionTransactionEditor case PhrictionTransaction::TYPE_DELETE: switch ($object->getStatus()) { case PhrictionDocumentStatus::STATUS_DELETED: - $e_text = pht('An already deleted document can not be deleted.'); + if ($xaction->getMetadataValue('contentDelete')) { + $e_text = pht( + 'This document is already deleted. You must specify '. + 'content to re-create the document and make further edits.'); + } else { + $e_text = pht( + 'An already deleted document can not be deleted.'); + } break; case PhrictionDocumentStatus::STATUS_MOVED: $e_text = pht('A moved document can not be deleted.');