diff --git a/resources/celerity/map.php b/resources/celerity/map.php --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -93,7 +93,7 @@ 'rsrc/css/application/policy/policy-edit.css' => '815c66f7', 'rsrc/css/application/policy/policy-transaction-detail.css' => '82100a43', 'rsrc/css/application/policy/policy.css' => '957ea14c', - 'rsrc/css/application/ponder/ponder-view.css' => '870153f4', + 'rsrc/css/application/ponder/ponder-view.css' => 'bef48f86', 'rsrc/css/application/projects/project-icon.css' => '4e3eaa5a', 'rsrc/css/application/releeph/releeph-core.css' => '9b3c5733', 'rsrc/css/application/releeph/releeph-preview-branch.css' => 'b7a6f4a5', @@ -811,7 +811,7 @@ 'policy-css' => '957ea14c', 'policy-edit-css' => '815c66f7', 'policy-transaction-detail-css' => '82100a43', - 'ponder-view-css' => '870153f4', + 'ponder-view-css' => 'bef48f86', 'project-icon-css' => '4e3eaa5a', 'raphael-core' => '51ee6b43', 'raphael-g' => '40dde778', diff --git a/src/applications/ponder/controller/PonderAnswerCommentController.php b/src/applications/ponder/controller/PonderAnswerCommentController.php --- a/src/applications/ponder/controller/PonderAnswerCommentController.php +++ b/src/applications/ponder/controller/PonderAnswerCommentController.php @@ -19,11 +19,12 @@ } $is_preview = $request->isPreviewRequest(); -// $draft = PhabricatorDraft::buildFromRequest($request); $qid = $answer->getQuestion()->getID(); $aid = $answer->getID(); - $view_uri = "/Q{$qid}#A{$aid}"; + + // TODO, this behaves badly when redirecting to the answer + $view_uri = "/Q{$qid}"; $xactions = array(); $xactions[] = id(new PonderAnswerTransaction()) @@ -46,9 +47,6 @@ ->setException($ex); } -// if ($draft) { -// $draft->replaceOrDelete(); -// } if ($request->isAjax() && $is_preview) { return id(new PhabricatorApplicationTransactionResponse()) diff --git a/src/applications/ponder/controller/PonderQuestionViewController.php b/src/applications/ponder/controller/PonderQuestionViewController.php --- a/src/applications/ponder/controller/PonderQuestionViewController.php +++ b/src/applications/ponder/controller/PonderQuestionViewController.php @@ -205,40 +205,28 @@ private function buildAnswers(array $answers) { $viewer = $this->getViewer(); - $xactions = id(new PonderAnswerTransactionQuery()) - ->setViewer($viewer) - ->withTransactionTypes(array(PhabricatorTransactions::TYPE_COMMENT)) - ->withObjectPHIDs(mpull($answers, 'getPHID')) - ->execute(); - - $engine = id(new PhabricatorMarkupEngine()) - ->setViewer($viewer); - foreach ($xactions as $xaction) { - if ($xaction->getComment()) { - $engine->addObject( - $xaction->getComment(), - PhabricatorApplicationTransactionComment::MARKUP_FIELD_COMMENT); - } - } - $engine->process(); - - $xaction_groups = mgroup($xactions, 'getObjectPHID'); $author_phids = mpull($answers, 'getAuthorPHID'); $handles = $this->loadViewerHandles($author_phids); $answers_sort = array_reverse(msort($answers, 'getVoteCount')); $view = array(); foreach ($answers_sort as $answer) { - $xactions = idx($xaction_groups, $answer->getPHID(), array()); $id = $answer->getID(); $handle = $handles[$answer->getAuthorPHID()]; + $timeline = $this->buildTransactionTimeline( + $answer, + id(new PonderAnswerTransactionQuery()) + ->withTransactionTypes(array(PhabricatorTransactions::TYPE_COMMENT))); + $xactions = $timeline->getTransactions(); + + $view[] = id(new PonderAnswerView()) ->setUser($viewer) ->setAnswer($answer) ->setTransactions($xactions) - ->setHandle($handle) - ->setMarkupEngine($engine); + ->setTimeline($timeline) + ->setHandle($handle); } diff --git a/src/applications/ponder/view/PonderAnswerView.php b/src/applications/ponder/view/PonderAnswerView.php --- a/src/applications/ponder/view/PonderAnswerView.php +++ b/src/applications/ponder/view/PonderAnswerView.php @@ -4,7 +4,7 @@ private $answer; private $transactions; - private $engine; + private $timeline; private $handle; public function setAnswer($answer) { @@ -17,8 +17,8 @@ return $this; } - public function setMarkupEngine(PhabricatorMarkupEngine $engine) { - $this->engine = $engine; + public function setTimeline($timeline) { + $this->timeline = $timeline; return $this; } @@ -124,12 +124,6 @@ ->appendChild($content) ->appendChild($footer); - $transaction_view = id(new PhabricatorApplicationTransactionView()) - ->setUser($viewer) - ->setObjectPHID($answer->getPHID()) - ->setTransactions($this->transactions) - ->setMarkupEngine($this->engine); - $comment_view = id(new PhabricatorApplicationTransactionCommentView()) ->setUser($viewer) ->setObjectPHID($answer->getPHID()) @@ -145,7 +139,7 @@ 'style' => 'display: none;', ), array( - $transaction_view, + $this->timeline, $comment_view, )); diff --git a/webroot/rsrc/css/application/ponder/ponder-view.css b/webroot/rsrc/css/application/ponder/ponder-view.css --- a/webroot/rsrc/css/application/ponder/ponder-view.css +++ b/webroot/rsrc/css/application/ponder/ponder-view.css @@ -26,6 +26,10 @@ margin-top: 16px; } +.device-desktop .ponder-answer-view .phui-timeline-view { + margin-left: 32px; +} + .ponder-answer-view .phui-header-subheader { display: inline; margin-left: 12px;