diff --git a/src/applications/phriction/controller/PhrictionEditController.php b/src/applications/phriction/controller/PhrictionEditController.php --- a/src/applications/phriction/controller/PhrictionEditController.php +++ b/src/applications/phriction/controller/PhrictionEditController.php @@ -156,10 +156,12 @@ 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 --- a/src/applications/phriction/editor/PhrictionTransactionEditor.php +++ b/src/applications/phriction/editor/PhrictionTransactionEditor.php @@ -131,14 +131,16 @@ $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 @@ 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 @@ 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 @@ 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 proceed.'); + } 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.');