Add draft support to ApplicationTransactions

Summary:
When previewing, save drafts. When loading objects, restore drafts if they are available.

Depends on: D665

Test Plan:
  - Viewed a Mock.
  - Typed text into the comment box.
  - Reloaded the page.
  - Text still there.
  - Hit submit, got my comment.
  - Reloaded the page.
  - Draft correctly deleted.
  - Repeated for Macros.

Reviewers: btrahan, chad, vrana

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T2104

Differential Revision: https://secure.phabricator.com/D4252
This commit is contained in:
epriestley
2012-12-21 05:57:14 -08:00
parent 0fd77783a4
commit b116861b16
11 changed files with 243 additions and 127 deletions

View File

@@ -23,6 +23,7 @@ final class PhabricatorMacroCommentController
}
$is_preview = $request->isPreviewRequest();
$draft = PhabricatorDraft::buildFromRequest($request);
$view_uri = $this->getApplicationURI('/view/'.$macro->getID().'/');
@@ -52,6 +53,10 @@ final class PhabricatorMacroCommentController
->setException($ex);
}
if ($draft) {
$draft->replaceOrDelete();
}
if ($request->isAjax()) {
return id(new PhabricatorApplicationTransactionResponse())
->setViewer($user)