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:
@@ -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)
|
||||
|
||||
@@ -83,8 +83,11 @@ final class PhabricatorMacroViewController
|
||||
? pht('Add Comment')
|
||||
: pht('Lavish Praise');
|
||||
|
||||
$draft = PhabricatorDraft::newFromUserAndKey($user, $macro->getPHID());
|
||||
|
||||
$add_comment_form = id(new PhabricatorApplicationTransactionCommentView())
|
||||
->setUser($user)
|
||||
->setDraft($draft)
|
||||
->setAction($this->getApplicationURI('/comment/'.$macro->getID().'/'))
|
||||
->setSubmitButtonName($submit_button_name);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user