From b718b429afc61796475cf537b7623c6c7b9c48ae Mon Sep 17 00:00:00 2001 From: Bob Trahan Date: Thu, 11 Dec 2014 10:27:28 -0800 Subject: [PATCH] Transactions - make quotes work for older transactions Summary: Fixes T6731. I don't really understand the intent behind the two view classes here, but to get this to work I need to pass yet more data to the lower-level class. Test Plan: Viewed a task with many comments. Clicked "show older". Quoted everything I could. Verified for each quote that it quoted correctly, inlcuding linking to the prior transaction. Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin, epriestley Maniphest Tasks: T6731 Differential Revision: https://secure.phabricator.com/D10973 --- .../base/controller/PhabricatorController.php | 4 ++- .../PhabricatorApplicationTransactionView.php | 2 ++ src/view/phui/PHUITimelineView.php | 25 ++++++++++++++++++- 3 files changed, 29 insertions(+), 2 deletions(-) diff --git a/src/applications/base/controller/PhabricatorController.php b/src/applications/base/controller/PhabricatorController.php index d2f172fc72..8a650fc7bd 100644 --- a/src/applications/base/controller/PhabricatorController.php +++ b/src/applications/base/controller/PhabricatorController.php @@ -566,7 +566,9 @@ abstract class PhabricatorController extends AphrontController { ->setObjectPHID($object->getPHID()) ->setTransactions($xactions) ->setPager($pager) - ->setRenderData($render_data); + ->setRenderData($render_data) + ->setQuoteTargetID($this->getRequest()->getStr('quoteTargetID')) + ->setQuoteRef($this->getRequest()->getStr('quoteRef')); $object->willRenderTimeline($timeline, $this->getRequest()); return $timeline; diff --git a/src/applications/transactions/view/PhabricatorApplicationTransactionView.php b/src/applications/transactions/view/PhabricatorApplicationTransactionView.php index 4988fb2ace..8cf3135578 100644 --- a/src/applications/transactions/view/PhabricatorApplicationTransactionView.php +++ b/src/applications/transactions/view/PhabricatorApplicationTransactionView.php @@ -198,6 +198,8 @@ class PhabricatorApplicationTransactionView extends AphrontView { $view = new PHUITimelineView(); $view->setShouldTerminate($this->shouldTerminate); + $view->setQuoteTargetID($this->getQuoteTargetID()); + $view->setQuoteRef($this->getQuoteRef()); $events = $this->buildEvents($with_hiding); foreach ($events as $event) { $view->addEvent($event); diff --git a/src/view/phui/PHUITimelineView.php b/src/view/phui/PHUITimelineView.php index d91924cc8d..a31d9cf8a3 100644 --- a/src/view/phui/PHUITimelineView.php +++ b/src/view/phui/PHUITimelineView.php @@ -8,6 +8,8 @@ final class PHUITimelineView extends AphrontView { private $shouldAddSpacers = true; private $pager; private $renderData = array(); + private $quoteTargetID; + private $quoteRef; public function setID($id) { $this->id = $id; @@ -43,6 +45,24 @@ final class PHUITimelineView extends AphrontView { return $this; } + public function setQuoteTargetID($quote_target_id) { + $this->quoteTargetID = $quote_target_id; + return $this; + } + + public function getQuoteTargetID() { + return $this->quoteTargetID; + } + + public function setQuoteRef($quote_ref) { + $this->quoteRef = $quote_ref; + return $this; + } + + public function getQuoteRef() { + return $this->quoteRef; + } + public function render() { if ($this->getPager()) { if ($this->id === null) { @@ -84,6 +104,9 @@ final class PHUITimelineView extends AphrontView { $events = array(); if ($hide && $this->getPager()) { + $uri = $this->getPager()->getNextPageURI(); + $uri->setQueryParam('quoteTargetID', $this->getQuoteTargetID()); + $uri->setQueryParam('quoteRef', $this->getQuoteRef()); $events[] = javelin_tag( 'div', array( @@ -96,7 +119,7 @@ final class PHUITimelineView extends AphrontView { javelin_tag( 'a', array( - 'href' => (string) $this->getPager()->getNextPageURI(), + 'href' => (string) $uri, 'mustcapture' => true, 'sigil' => 'show-older-link', ),