@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Fix some quirkiness with Answer comments in Ponder

Summary: There is still some general buginess with answer comments, trying to work them out. This replaces timeline rendering into one offs (less performant) but resolves many bugs. Or if there is a more performant way, let me know? Also when leaving an answer comment, you currently get redirected back to the page, but both the comment form is still populated and you dont see your answer without a reload. I feel like I'm missing some magical parameter to pass, so just redirecting back to the question itself.

Test Plan: Leave lots of answer comments.

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin

Differential Revision: https://secure.phabricator.com/D13946

+22 -38
+2 -2
resources/celerity/map.php
··· 93 93 'rsrc/css/application/policy/policy-edit.css' => '815c66f7', 94 94 'rsrc/css/application/policy/policy-transaction-detail.css' => '82100a43', 95 95 'rsrc/css/application/policy/policy.css' => '957ea14c', 96 - 'rsrc/css/application/ponder/ponder-view.css' => '870153f4', 96 + 'rsrc/css/application/ponder/ponder-view.css' => 'bef48f86', 97 97 'rsrc/css/application/projects/project-icon.css' => '4e3eaa5a', 98 98 'rsrc/css/application/releeph/releeph-core.css' => '9b3c5733', 99 99 'rsrc/css/application/releeph/releeph-preview-branch.css' => 'b7a6f4a5', ··· 811 811 'policy-css' => '957ea14c', 812 812 'policy-edit-css' => '815c66f7', 813 813 'policy-transaction-detail-css' => '82100a43', 814 - 'ponder-view-css' => '870153f4', 814 + 'ponder-view-css' => 'bef48f86', 815 815 'project-icon-css' => '4e3eaa5a', 816 816 'raphael-core' => '51ee6b43', 817 817 'raphael-g' => '40dde778',
+3 -5
src/applications/ponder/controller/PonderAnswerCommentController.php
··· 19 19 } 20 20 21 21 $is_preview = $request->isPreviewRequest(); 22 - // $draft = PhabricatorDraft::buildFromRequest($request); 23 22 24 23 $qid = $answer->getQuestion()->getID(); 25 24 $aid = $answer->getID(); 26 - $view_uri = "/Q{$qid}#A{$aid}"; 25 + 26 + // TODO, this behaves badly when redirecting to the answer 27 + $view_uri = "/Q{$qid}"; 27 28 28 29 $xactions = array(); 29 30 $xactions[] = id(new PonderAnswerTransaction()) ··· 46 47 ->setException($ex); 47 48 } 48 49 49 - // if ($draft) { 50 - // $draft->replaceOrDelete(); 51 - // } 52 50 53 51 if ($request->isAjax() && $is_preview) { 54 52 return id(new PhabricatorApplicationTransactionResponse())
+9 -21
src/applications/ponder/controller/PonderQuestionViewController.php
··· 205 205 private function buildAnswers(array $answers) { 206 206 $viewer = $this->getViewer(); 207 207 208 - $xactions = id(new PonderAnswerTransactionQuery()) 209 - ->setViewer($viewer) 210 - ->withTransactionTypes(array(PhabricatorTransactions::TYPE_COMMENT)) 211 - ->withObjectPHIDs(mpull($answers, 'getPHID')) 212 - ->execute(); 213 - 214 - $engine = id(new PhabricatorMarkupEngine()) 215 - ->setViewer($viewer); 216 - foreach ($xactions as $xaction) { 217 - if ($xaction->getComment()) { 218 - $engine->addObject( 219 - $xaction->getComment(), 220 - PhabricatorApplicationTransactionComment::MARKUP_FIELD_COMMENT); 221 - } 222 - } 223 - $engine->process(); 224 - 225 - $xaction_groups = mgroup($xactions, 'getObjectPHID'); 226 208 $author_phids = mpull($answers, 'getAuthorPHID'); 227 209 $handles = $this->loadViewerHandles($author_phids); 228 210 $answers_sort = array_reverse(msort($answers, 'getVoteCount')); 229 211 230 212 $view = array(); 231 213 foreach ($answers_sort as $answer) { 232 - $xactions = idx($xaction_groups, $answer->getPHID(), array()); 233 214 $id = $answer->getID(); 234 215 $handle = $handles[$answer->getAuthorPHID()]; 235 216 217 + $timeline = $this->buildTransactionTimeline( 218 + $answer, 219 + id(new PonderAnswerTransactionQuery()) 220 + ->withTransactionTypes(array(PhabricatorTransactions::TYPE_COMMENT))); 221 + $xactions = $timeline->getTransactions(); 222 + 223 + 236 224 $view[] = id(new PonderAnswerView()) 237 225 ->setUser($viewer) 238 226 ->setAnswer($answer) 239 227 ->setTransactions($xactions) 240 - ->setHandle($handle) 241 - ->setMarkupEngine($engine); 228 + ->setTimeline($timeline) 229 + ->setHandle($handle); 242 230 243 231 } 244 232
+4 -10
src/applications/ponder/view/PonderAnswerView.php
··· 4 4 5 5 private $answer; 6 6 private $transactions; 7 - private $engine; 7 + private $timeline; 8 8 private $handle; 9 9 10 10 public function setAnswer($answer) { ··· 17 17 return $this; 18 18 } 19 19 20 - public function setMarkupEngine(PhabricatorMarkupEngine $engine) { 21 - $this->engine = $engine; 20 + public function setTimeline($timeline) { 21 + $this->timeline = $timeline; 22 22 return $this; 23 23 } 24 24 ··· 124 124 ->appendChild($content) 125 125 ->appendChild($footer); 126 126 127 - $transaction_view = id(new PhabricatorApplicationTransactionView()) 128 - ->setUser($viewer) 129 - ->setObjectPHID($answer->getPHID()) 130 - ->setTransactions($this->transactions) 131 - ->setMarkupEngine($this->engine); 132 - 133 127 $comment_view = id(new PhabricatorApplicationTransactionCommentView()) 134 128 ->setUser($viewer) 135 129 ->setObjectPHID($answer->getPHID()) ··· 145 139 'style' => 'display: none;', 146 140 ), 147 141 array( 148 - $transaction_view, 142 + $this->timeline, 149 143 $comment_view, 150 144 )); 151 145
+4
webroot/rsrc/css/application/ponder/ponder-view.css
··· 26 26 margin-top: 16px; 27 27 } 28 28 29 + .device-desktop .ponder-answer-view .phui-timeline-view { 30 + margin-left: 32px; 31 + } 32 + 29 33 .ponder-answer-view .phui-header-subheader { 30 34 display: inline; 31 35 margin-left: 12px;