mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-22 23:02:42 +01:00
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
This commit is contained in:
parent
e19c555913
commit
152e7713eb
1 changed files with 2 additions and 43 deletions
|
@ -72,43 +72,6 @@ final class PhrictionEditController
|
|||
}
|
||||
}
|
||||
|
||||
if ($request->getBool('nodraft')) {
|
||||
$draft = null;
|
||||
$draft_key = null;
|
||||
} else {
|
||||
if ($document->getPHID()) {
|
||||
$draft_key = $document->getPHID().':'.$content->getVersion();
|
||||
} else {
|
||||
$draft_key = 'phriction:'.$content->getSlug();
|
||||
}
|
||||
$draft = id(new PhabricatorDraft())->loadOneWhere(
|
||||
'authorPHID = %s AND draftKey = %s',
|
||||
$viewer->getPHID(),
|
||||
$draft_key);
|
||||
}
|
||||
|
||||
if ($draft &&
|
||||
strlen($draft->getDraft()) &&
|
||||
($draft->getDraft() != $content->getContent())) {
|
||||
$content_text = $draft->getDraft();
|
||||
|
||||
$discard = phutil_tag(
|
||||
'a',
|
||||
array(
|
||||
'href' => $request->getRequestURI()->alter('nodraft', true),
|
||||
),
|
||||
pht('discard this draft'));
|
||||
|
||||
$draft_note = new PHUIInfoView();
|
||||
$draft_note->setSeverity(PHUIInfoView::SEVERITY_NOTICE);
|
||||
$draft_note->setTitle(pht('Recovered Draft'));
|
||||
$draft_note->appendChild(
|
||||
pht('Showing a saved draft of your edits, you can %s.', $discard));
|
||||
} else {
|
||||
$content_text = $content->getContent();
|
||||
$draft_note = null;
|
||||
}
|
||||
|
||||
require_celerity_resource('phriction-document-css');
|
||||
|
||||
$e_title = true;
|
||||
|
@ -131,6 +94,8 @@ final class PhrictionEditController
|
|||
|
||||
$v_space = $document->getSpacePHID();
|
||||
|
||||
$content_text = $content->getContent();
|
||||
|
||||
if ($request->isFormPost()) {
|
||||
|
||||
$title = $request->getStr('title');
|
||||
|
@ -181,10 +146,6 @@ final class PhrictionEditController
|
|||
try {
|
||||
$editor->applyTransactions($document, $xactions);
|
||||
|
||||
if ($draft) {
|
||||
$draft->delete();
|
||||
}
|
||||
|
||||
$uri = PhrictionDocument::getSlugURI($document->getSlug());
|
||||
return id(new AphrontRedirectResponse())->setURI($uri);
|
||||
} catch (PhabricatorApplicationTransactionValidationException $ex) {
|
||||
|
@ -239,7 +200,6 @@ final class PhrictionEditController
|
|||
$form = id(new AphrontFormView())
|
||||
->setUser($viewer)
|
||||
->addHiddenInput('slug', $document->getSlug())
|
||||
->addHiddenInput('nodraft', $request->getBool('nodraft'))
|
||||
->addHiddenInput('contentVersion', $max_version)
|
||||
->addHiddenInput('overwrite', $overwrite)
|
||||
->appendChild(
|
||||
|
@ -325,7 +285,6 @@ final class PhrictionEditController
|
|||
$view = id(new PHUITwoColumnView())
|
||||
->setFooter(
|
||||
array(
|
||||
$draft_note,
|
||||
$form_box,
|
||||
$preview,
|
||||
));
|
||||
|
|
Loading…
Reference in a new issue