Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15426417
D10931.id26254.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
7 KB
Referenced Files
None
Subscribers
None
D10931.id26254.diff
View Options
diff --git a/src/applications/base/controller/PhabricatorController.php b/src/applications/base/controller/PhabricatorController.php
--- a/src/applications/base/controller/PhabricatorController.php
+++ b/src/applications/base/controller/PhabricatorController.php
@@ -529,7 +529,8 @@
protected function buildTransactionTimeline(
PhabricatorApplicationTransactionInterface $object,
PhabricatorApplicationTransactionQuery $query,
- PhabricatorMarkupEngine $engine = null) {
+ PhabricatorMarkupEngine $engine = null,
+ $render_data = array()) {
$viewer = $this->getRequest()->getUser();
$xaction = $object->getApplicationTransactionTemplate();
@@ -564,7 +565,9 @@
->setUser($viewer)
->setObjectPHID($object->getPHID())
->setTransactions($xactions)
- ->setPager($pager);
+ ->setPager($pager)
+ ->setRenderData($render_data);
+ $object->willRenderTimeline($timeline, $this->getRequest());
return $timeline;
}
diff --git a/src/applications/differential/controller/DifferentialRevisionViewController.php b/src/applications/differential/controller/DifferentialRevisionViewController.php
--- a/src/applications/differential/controller/DifferentialRevisionViewController.php
+++ b/src/applications/differential/controller/DifferentialRevisionViewController.php
@@ -928,12 +928,12 @@
$timeline = $this->buildTransactionTimeline(
$revision,
- new DifferentialTransactionQuery());
- $timeline
- ->setChangesets($changesets)
- ->setRevision($revision)
- ->setLeftDiff($left_diff)
- ->setRightDiff($right_diff);
+ new DifferentialTransactionQuery(),
+ $engine = null,
+ array(
+ 'left' => $left_diff->getID(),
+ 'right' => $right_diff->getID(),
+ ));
return $timeline;
}
diff --git a/src/applications/differential/storage/DifferentialRevision.php b/src/applications/differential/storage/DifferentialRevision.php
--- a/src/applications/differential/storage/DifferentialRevision.php
+++ b/src/applications/differential/storage/DifferentialRevision.php
@@ -475,6 +475,35 @@
return new DifferentialTransaction();
}
+ public function willRenderTimeline(
+ PhabricatorApplicationTransactionView $timeline,
+ AphrontRequest $request) {
+
+ $render_data = $timeline->getRenderData();
+ $left = $request->getInt('left', idx($render_data, 'left'));
+ $right = $request->getInt('right', idx($render_data, 'right'));
+
+ $diffs = id(new DifferentialDiffQuery())
+ ->setViewer($request->getUser())
+ ->withIDs(array($left, $right))
+ ->execute();
+ $diffs = mpull($diffs, null, 'getID');
+ $left_diff = $diffs[$left];
+ $right_diff = $diffs[$right];
+
+ $changesets = id(new DifferentialChangesetQuery())
+ ->setViewer($request->getUser())
+ ->withDiffs(array($right_diff))
+ ->execute();
+ $changesets = mpull($changesets, null, 'getID');
+
+ return $timeline
+ ->setChangesets($changesets)
+ ->setRevision($this)
+ ->setLeftDiff($left_diff)
+ ->setRightDiff($right_diff);
+ }
+
/* -( PhabricatorDestructibleInterface )----------------------------------- */
diff --git a/src/applications/pholio/storage/PholioMock.php b/src/applications/pholio/storage/PholioMock.php
--- a/src/applications/pholio/storage/PholioMock.php
+++ b/src/applications/pholio/storage/PholioMock.php
@@ -264,6 +264,13 @@
return new PholioTransaction();
}
+ public function willRenderTimeline(
+ PhabricatorApplicationTransactionView $timeline,
+ AphrontRequest $request) {
+
+ $timeline->setMock($this);
+ return $timeline;
+ }
/* -( PhabricatorTokenReceiverInterface )---------------------------------- */
diff --git a/src/applications/transactions/interface/PhabricatorApplicationTransactionInterface.php b/src/applications/transactions/interface/PhabricatorApplicationTransactionInterface.php
--- a/src/applications/transactions/interface/PhabricatorApplicationTransactionInterface.php
+++ b/src/applications/transactions/interface/PhabricatorApplicationTransactionInterface.php
@@ -35,6 +35,10 @@
*/
public function getApplicationTransactionTemplate();
+ public function willRenderTimeline(
+ PhabricatorApplicationTransactionView $timeline,
+ AphrontRequest $request);
+
}
// TEMPLATE IMPLEMENTATION /////////////////////////////////////////////////////
@@ -55,4 +59,11 @@
return new <<<???>>>Transaction();
}
+ public function willRenderTimeline(
+ PhabricatorApplicationTransactionView $timeline,
+ AphrontRequest $request) {
+
+ return $timeline;
+ }
+
*/
diff --git a/src/applications/transactions/view/PhabricatorApplicationTransactionView.php b/src/applications/transactions/view/PhabricatorApplicationTransactionView.php
--- a/src/applications/transactions/view/PhabricatorApplicationTransactionView.php
+++ b/src/applications/transactions/view/PhabricatorApplicationTransactionView.php
@@ -14,6 +14,7 @@
private $quoteTargetID;
private $quoteRef;
private $pager;
+ private $renderData = array();
public function setQuoteRef($quote_ref) {
$this->quoteRef = $quote_ref;
@@ -85,6 +86,21 @@
return $this->pager;
}
+ /**
+ * This is additional data that may be necessary to render the next set
+ * of transactions. Objects that implement
+ * PhabricatorApplicationTransactionInterface use this data in
+ * willRenderTimeline.
+ */
+ public function setRenderData(array $data) {
+ $this->renderData = $data;
+ return $this;
+ }
+
+ public function getRenderData() {
+ return $this->renderData;
+ }
+
public function buildEvents($with_hiding = false) {
$user = $this->getUser();
@@ -186,6 +202,9 @@
if ($this->getPager()) {
$view->setPager($this->getPager());
}
+ if ($this->getRenderData()) {
+ $view->setRenderData($this->getRenderData());
+ }
return $view;
}
diff --git a/src/view/phui/PHUITimelineView.php b/src/view/phui/PHUITimelineView.php
--- a/src/view/phui/PHUITimelineView.php
+++ b/src/view/phui/PHUITimelineView.php
@@ -7,6 +7,7 @@
private $shouldTerminate = false;
private $shouldAddSpacers = true;
private $pager;
+ private $renderData = array();
public function setID($id) {
$this->id = $id;
@@ -37,6 +38,11 @@
return $this;
}
+ public function setRenderData(array $data) {
+ $this->renderData = $data;
+ return $this;
+ }
+
public function render() {
if ($this->getPager()) {
if ($this->id === null) {
@@ -46,6 +52,7 @@
'phabricator-show-older-transactions',
array(
'timelineID' => $this->id,
+ 'renderData' => $this->renderData,
));
}
$events = $this->buildEvents();
diff --git a/webroot/rsrc/js/application/transactions/behavior-show-older-transactions.js b/webroot/rsrc/js/application/transactions/behavior-show-older-transactions.js
--- a/webroot/rsrc/js/application/transactions/behavior-show-older-transactions.js
+++ b/webroot/rsrc/js/application/transactions/behavior-show-older-transactions.js
@@ -82,7 +82,7 @@
};
var fetch_older_workflow = function(href, callback, swap) {
- return new JX.Workflow(href)
+ return new JX.Workflow(href, config.renderData)
.setHandler(JX.bind(null, callback, swap));
};
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Mar 24, 8:36 AM (1 w, 5 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7719947
Default Alt Text
D10931.id26254.diff (7 KB)
Attached To
Mode
D10931: Transactions - adding willRenderTimeline to handle tricky cases
Attached
Detach File
Event Timeline
Log In to Comment