@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

+21 -8
+6 -4
src/applications/phriction/controller/PhrictionEditController.php
··· 156 156 return id(new AphrontRedirectResponse())->setURI($uri); 157 157 } catch (PhabricatorApplicationTransactionValidationException $ex) { 158 158 $validation_exception = $ex; 159 - $e_title = $ex->getShortMessage( 160 - PhrictionTransaction::TYPE_TITLE); 161 - $e_content = $ex->getShortMessage( 162 - PhrictionTransaction::TYPE_CONTENT); 159 + $e_title = nonempty( 160 + $ex->getShortMessage(PhrictionTransaction::TYPE_TITLE), 161 + true); 162 + $e_content = nonempty( 163 + $ex->getShortMessage(PhrictionTransaction::TYPE_CONTENT), 164 + true); 163 165 164 166 // if we're not supposed to process the content version error, then 165 167 // overwrite that content...!
+15 -4
src/applications/phriction/editor/PhrictionTransactionEditor.php
··· 131 131 $dict = array( 132 132 'id' => $document->getID(), 133 133 'phid' => $document->getPHID(), 134 - 'content' => $document->getContent()->getContent(),); 134 + 'content' => $document->getContent()->getContent(), 135 + 'title' => $document->getContent()->getTitle(),); 135 136 return $dict; 136 137 case PhrictionTransaction::TYPE_MOVE_AWAY: 137 138 $document = $xaction->getNewValue(); 138 139 $dict = array( 139 140 'id' => $document->getID(), 140 141 'phid' => $document->getPHID(), 141 - 'content' => $document->getContent()->getContent(),); 142 + 'content' => $document->getContent()->getContent(), 143 + 'title' => $document->getContent()->getTitle(),); 142 144 return $dict; 143 145 } 144 146 } ··· 201 203 if ($content === '') { 202 204 $xactions[] = id(new PhrictionTransaction()) 203 205 ->setTransactionType(PhrictionTransaction::TYPE_DELETE) 204 - ->setNewValue(true); 206 + ->setNewValue(true) 207 + ->setMetadataValue('contentDelete', true); 205 208 } 206 209 break; 207 210 case PhrictionTransaction::TYPE_MOVE_TO: ··· 240 243 case PhrictionTransaction::TYPE_MOVE_TO: 241 244 $dict = $xaction->getNewValue(); 242 245 $this->getNewContent()->setContent($dict['content']); 246 + $this->getNewContent()->setTitle($dict['title']); 243 247 $this->getNewContent()->setChangeType( 244 248 PhrictionChangeType::CHANGE_MOVE_HERE); 245 249 $this->getNewContent()->setChangeRef($dict['id']); ··· 603 607 case PhrictionTransaction::TYPE_DELETE: 604 608 switch ($object->getStatus()) { 605 609 case PhrictionDocumentStatus::STATUS_DELETED: 606 - $e_text = pht('An already deleted document can not be deleted.'); 610 + if ($xaction->getMetadataValue('contentDelete')) { 611 + $e_text = pht( 612 + 'This document is already deleted. You must specify '. 613 + 'content to re-create the document and make further edits.'); 614 + } else { 615 + $e_text = pht( 616 + 'An already deleted document can not be deleted.'); 617 + } 607 618 break; 608 619 case PhrictionDocumentStatus::STATUS_MOVED: 609 620 $e_text = pht('A moved document can not be deleted.');