mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-14 10:52:41 +01:00
e6967ed2ec
Summary: Ref T3578. Unroll these static methods for consistency. Test Plan: grep Reviewers: btrahan Reviewed By: btrahan CC: aran Maniphest Tasks: T3578 Differential Revision: https://secure.phabricator.com/D6602
40 lines
1 KiB
PHP
40 lines
1 KiB
PHP
<?php
|
|
|
|
final class PonderAnswerPreviewController
|
|
extends PonderController {
|
|
|
|
public function processRequest() {
|
|
$request = $this->getRequest();
|
|
$viewer = $request->getUser();
|
|
$question_id = $request->getInt('question_id');
|
|
|
|
$question = id(new PonderQuestionQuery())
|
|
->setViewer($viewer)
|
|
->withIDs(array($question_id))
|
|
->executeOne();
|
|
if (!$question) {
|
|
return new Aphront404Response();
|
|
}
|
|
|
|
$author_phid = $viewer->getPHID();
|
|
$object_phids = array($author_phid);
|
|
$handles = $this->loadViewerHandles($object_phids);
|
|
|
|
$answer = new PonderAnswer();
|
|
$answer->setContent($request->getStr('content'));
|
|
$answer->setAuthorPHID($author_phid);
|
|
|
|
$view = new PonderPostBodyView();
|
|
$view
|
|
->setQuestion($question)
|
|
->setTarget($answer)
|
|
->setPreview(true)
|
|
->setUser($viewer)
|
|
->setHandles($handles)
|
|
->setAction(PonderLiterals::LITERAL_ANSWERED);
|
|
|
|
return id(new AphrontAjaxResponse())
|
|
->setContent($view->render());
|
|
}
|
|
|
|
}
|