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

Remove obsolete, nonfunctional draft auto-saving in Phriction

Summary:
Depends on D19660. Ref T5811. Ref T13077.

Long ago, if you started editing a Phriction document but didn't save it, we'd save the draft in the background as part of the preview.

D11169 updated the preview to use shared infrastructure and broke this function, since we never save drafts.

Since this doesn't work right now, I want to add another thing called "draft", and the future of this feature should be more integrated with modern drafts and EditEngine (which fixed some bugs related to versioning), just get rid of this code for the moment.

Test Plan: Edited documents. This code doesn't do anything since D11169, so no behavior changed.

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T13077, T5811

Differential Revision: https://secure.phabricator.com/D19661

+2 -43
+2 -43
src/applications/phriction/controller/PhrictionEditController.php
··· 72 72 } 73 73 } 74 74 75 - if ($request->getBool('nodraft')) { 76 - $draft = null; 77 - $draft_key = null; 78 - } else { 79 - if ($document->getPHID()) { 80 - $draft_key = $document->getPHID().':'.$content->getVersion(); 81 - } else { 82 - $draft_key = 'phriction:'.$content->getSlug(); 83 - } 84 - $draft = id(new PhabricatorDraft())->loadOneWhere( 85 - 'authorPHID = %s AND draftKey = %s', 86 - $viewer->getPHID(), 87 - $draft_key); 88 - } 89 - 90 - if ($draft && 91 - strlen($draft->getDraft()) && 92 - ($draft->getDraft() != $content->getContent())) { 93 - $content_text = $draft->getDraft(); 94 - 95 - $discard = phutil_tag( 96 - 'a', 97 - array( 98 - 'href' => $request->getRequestURI()->alter('nodraft', true), 99 - ), 100 - pht('discard this draft')); 101 - 102 - $draft_note = new PHUIInfoView(); 103 - $draft_note->setSeverity(PHUIInfoView::SEVERITY_NOTICE); 104 - $draft_note->setTitle(pht('Recovered Draft')); 105 - $draft_note->appendChild( 106 - pht('Showing a saved draft of your edits, you can %s.', $discard)); 107 - } else { 108 - $content_text = $content->getContent(); 109 - $draft_note = null; 110 - } 111 - 112 75 require_celerity_resource('phriction-document-css'); 113 76 114 77 $e_title = true; ··· 130 93 } 131 94 132 95 $v_space = $document->getSpacePHID(); 96 + 97 + $content_text = $content->getContent(); 133 98 134 99 if ($request->isFormPost()) { 135 100 ··· 181 146 try { 182 147 $editor->applyTransactions($document, $xactions); 183 148 184 - if ($draft) { 185 - $draft->delete(); 186 - } 187 - 188 149 $uri = PhrictionDocument::getSlugURI($document->getSlug()); 189 150 return id(new AphrontRedirectResponse())->setURI($uri); 190 151 } catch (PhabricatorApplicationTransactionValidationException $ex) { ··· 239 200 $form = id(new AphrontFormView()) 240 201 ->setUser($viewer) 241 202 ->addHiddenInput('slug', $document->getSlug()) 242 - ->addHiddenInput('nodraft', $request->getBool('nodraft')) 243 203 ->addHiddenInput('contentVersion', $max_version) 244 204 ->addHiddenInput('overwrite', $overwrite) 245 205 ->appendChild( ··· 325 285 $view = id(new PHUITwoColumnView()) 326 286 ->setFooter( 327 287 array( 328 - $draft_note, 329 288 $form_box, 330 289 $preview, 331 290 ));