2012-08-10 19:44:04 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
final class PonderQuestionPreviewController
|
|
|
|
extends PonderController {
|
|
|
|
|
|
|
|
const VERB_ASKED = "asked";
|
|
|
|
|
|
|
|
public function processRequest() {
|
|
|
|
|
|
|
|
$request = $this->getRequest();
|
|
|
|
|
|
|
|
$user = $request->getUser();
|
|
|
|
$author_phid = $user->getPHID();
|
|
|
|
|
|
|
|
$object_phids = array($author_phid);
|
2012-09-05 04:02:56 +02:00
|
|
|
$handles = $this->loadViewerHandles($object_phids);
|
2012-08-10 19:44:04 +02:00
|
|
|
|
|
|
|
$question = new PonderQuestion();
|
|
|
|
$question->setContent($request->getStr('content'));
|
|
|
|
$question->setAuthorPHID($author_phid);
|
|
|
|
|
adding comments to ponder
Summary: This is pretty spartan, but it does the job.
Test Plan:
Patch, update storage, add some comment
to your favorite question or answer.
Reviewers: nh, vrana, epriestley
Reviewed By: epriestley
CC: aran, Korvin, starruler, syrneus, me.here, victorzarate7
Maniphest Tasks: T1645
Differential Revision: https://secure.phabricator.com/D3471
2012-09-11 21:13:20 +02:00
|
|
|
$view = new PonderPostBodyView();
|
2012-08-10 19:44:04 +02:00
|
|
|
$view
|
|
|
|
->setQuestion($question)
|
|
|
|
->setTarget($question)
|
|
|
|
->setPreview(true)
|
|
|
|
->setUser($user)
|
|
|
|
->setHandles($handles)
|
|
|
|
->setAction(self::VERB_ASKED);
|
|
|
|
|
|
|
|
return id(new AphrontAjaxResponse())
|
|
|
|
->setContent($view->render());
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|