3 final class PhabricatorSlowvoteCommentController
4 extends PhabricatorSlowvoteController
{
6 public function handleRequest(AphrontRequest
$request) {
7 $viewer = $request->getViewer();
8 $id = $request->getURIData('id');
10 if (!$request->isFormPost()) {
11 return new Aphront400Response();
14 $poll = id(new PhabricatorSlowvoteQuery())
19 return new Aphront404Response();
22 $is_preview = $request->isPreviewRequest();
23 $draft = PhabricatorDraft
::buildFromRequest($request);
25 $view_uri = '/V'.$poll->getID();
28 $xactions[] = id(new PhabricatorSlowvoteTransaction())
29 ->setTransactionType(PhabricatorTransactions
::TYPE_COMMENT
)
31 id(new PhabricatorSlowvoteTransactionComment())
32 ->setContent($request->getStr('comment')));
34 $editor = id(new PhabricatorSlowvoteEditor())
36 ->setContinueOnNoEffect($request->isContinueRequest())
37 ->setContentSourceFromRequest($request)
38 ->setIsPreview($is_preview);
41 $xactions = $editor->applyTransactions($poll, $xactions);
42 } catch (PhabricatorApplicationTransactionNoEffectException
$ex) {
43 return id(new PhabricatorApplicationTransactionNoEffectResponse())
44 ->setCancelURI($view_uri)
49 $draft->replaceOrDelete();
52 if ($request->isAjax() && $is_preview) {
53 return id(new PhabricatorApplicationTransactionResponse())
56 ->setTransactions($xactions)
57 ->setIsPreview($is_preview);
59 return id(new AphrontRedirectResponse())