1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-23 14:00:56 +01:00

Phriction - clarify error message when trying to delete already deleted content

Summary: Fixes T7325, T7326, T7328. When you have deleted a document already you have to specify content; this makes this more clear to the user in this specific delete pathway. Also, includes bonus bug fix for T7326 where we weren't moving the title of the wiki page with the rest of the page.

Test Plan: moved a wiki doc and verified it had the title I had specified. tried to delete an already deleted doc via setting the content to blank (i.e. hitting save after making some other edits) and got more clear error UI state

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin, epriestley

Maniphest Tasks: T7328, T7325, T7326

Differential Revision: https://secure.phabricator.com/D11829
This commit is contained in:
Bob Trahan 2015-02-20 08:22:52 -08:00
parent 543cb1c900
commit 0a0ac11429
2 changed files with 21 additions and 8 deletions

View file

@ -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...!

View file

@ -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.');