Changeset View
Changeset View
Standalone View
Standalone View
src/applications/ponder/controller/PonderQuestionViewController.php
| <?php | <?php | ||||
| final class PonderQuestionViewController extends PonderController { | final class PonderQuestionViewController extends PonderController { | ||||
| public function handleRequest(AphrontRequest $request) { | public function handleRequest(AphrontRequest $request) { | ||||
| $viewer = $request->getViewer(); | $viewer = $request->getViewer(); | ||||
| $id = $request->getURIData('id'); | $id = $request->getURIData('id'); | ||||
| $question = id(new PonderQuestionQuery()) | $question = id(new PonderQuestionQuery()) | ||||
| ->setViewer($viewer) | ->setViewer($viewer) | ||||
| ->withIDs(array($id)) | ->withIDs(array($id)) | ||||
| ->needAnswers(true) | ->needAnswers(true) | ||||
| ->needViewerVotes(true) | |||||
| ->executeOne(); | ->executeOne(); | ||||
| if (!$question) { | if (!$question) { | ||||
| return new Aphront404Response(); | return new Aphront404Response(); | ||||
| } | } | ||||
| $question->attachVotes($viewer->getPHID()); | |||||
| $question_xactions = $this->buildQuestionTransactions($question); | $question_xactions = $this->buildQuestionTransactions($question); | ||||
| $answers = $this->buildAnswers($question->getAnswers()); | $answers = $this->buildAnswers($question->getAnswers()); | ||||
| $authors = mpull($question->getAnswers(), null, 'getAuthorPHID'); | $authors = mpull($question->getAnswers(), null, 'getAuthorPHID'); | ||||
| if (isset($authors[$viewer->getPHID()])) { | if (isset($authors[$viewer->getPHID()])) { | ||||
| $answer_add_panel = id(new PHUIInfoView()) | $answer_add_panel = id(new PHUIInfoView()) | ||||
| ->setSeverity(PHUIInfoView::SEVERITY_NOTICE) | ->setSeverity(PHUIInfoView::SEVERITY_NOTICE) | ||||
| ->appendChild( | ->appendChild( | ||||
| ▲ Show 20 Lines • Show All 362 Lines • Show Last 20 Lines | |||||