From 6ab3f06b6ec64f881e20fc46bd4b47860f1748c1 Mon Sep 17 00:00:00 2001 From: Bob Trahan Date: Thu, 4 Dec 2014 13:58:52 -0800 Subject: [PATCH] Transactions - adding willRenderTimeline to handle tricky cases Summary: Fixes T6693. Test Plan: Made a bunch of comments on a diff with differential, being sure to leave inlines here and there. This reproduced the issue in T6693. With this patch this issue no longer reproduces! Successfully "showed older changes" in Maniphest too. Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin, epriestley Maniphest Tasks: T6693 Differential Revision: https://secure.phabricator.com/D10931 --- resources/celerity/map.php | 16 +++++----- .../almanac/storage/AlmanacBinding.php | 7 +++++ .../almanac/storage/AlmanacDevice.php | 7 +++++ .../almanac/storage/AlmanacNetwork.php | 7 +++++ .../almanac/storage/AlmanacService.php | 7 +++++ .../storage/PhabricatorAuthProviderConfig.php | 7 +++++ .../base/controller/PhabricatorController.php | 7 +++-- .../config/storage/PhabricatorConfigEntry.php | 7 +++++ .../storage/PhabricatorDashboard.php | 7 +++++ .../storage/PhabricatorDashboardPanel.php | 7 +++++ .../DifferentialRevisionViewController.php | 12 ++++---- .../differential/storage/DifferentialDiff.php | 9 ++++-- .../storage/DifferentialRevision.php | 29 +++++++++++++++++++ .../drydock/storage/DrydockBlueprint.php | 7 +++++ .../files/storage/PhabricatorFile.php | 7 +++++ src/applications/fund/storage/FundBacker.php | 7 +++++ .../fund/storage/FundInitiative.php | 7 +++++ .../storage/HarbormasterBuildable.php | 7 +++++ .../storage/build/HarbormasterBuild.php | 7 +++++ .../configuration/HarbormasterBuildPlan.php | 7 +++++ .../configuration/HarbormasterBuildStep.php | 7 +++++ .../herald/storage/HeraldRule.php | 10 +++++++ .../legalpad/storage/LegalpadDocument.php | 7 +++++ .../storage/PhabricatorFileImageMacro.php | 7 +++++ .../maniphest/storage/ManiphestTask.php | 7 +++++ .../nuance/storage/NuanceSource.php | 7 +++++ .../storage/PassphraseCredential.php | 7 +++++ .../paste/storage/PhabricatorPaste.php | 7 +++++ .../phlux/storage/PhluxVariable.php | 7 +++++ .../pholio/storage/PholioMock.php | 7 +++++ .../phortune/storage/PhortuneAccount.php | 7 +++++ .../phortune/storage/PhortuneCart.php | 7 +++++ .../phortune/storage/PhortuneMerchant.php | 7 +++++ .../phriction/storage/PhrictionDocument.php | 6 ++++ .../ponder/storage/PonderAnswer.php | 7 +++++ .../ponder/storage/PonderQuestion.php | 7 +++++ .../project/storage/PhabricatorProject.php | 7 +++++ .../storage/PhabricatorProjectColumn.php | 7 +++++ .../releeph/storage/ReleephBranch.php | 7 +++++ .../releeph/storage/ReleephProject.php | 7 +++++ .../releeph/storage/ReleephRequest.php | 7 +++++ .../storage/PhabricatorRepository.php | 7 +++++ .../storage/PhabricatorRepositoryCommit.php | 7 +++++ .../storage/PhabricatorSlowvotePoll.php | 7 +++++ ...ricatorApplicationTransactionInterface.php | 16 ++++++++++ .../PhabricatorApplicationTransactionView.php | 19 ++++++++++++ src/view/phui/PHUITimelineView.php | 7 +++++ .../behavior-show-older-transactions.js | 2 +- 48 files changed, 373 insertions(+), 19 deletions(-) diff --git a/resources/celerity/map.php b/resources/celerity/map.php index 148df0336b..0bc98c6f64 100644 --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -421,7 +421,7 @@ return array( 'rsrc/js/application/repository/repository-crossreference.js' => 'f9539603', 'rsrc/js/application/search/behavior-reorder-queries.js' => 'e9581f08', 'rsrc/js/application/slowvote/behavior-slowvote-embed.js' => 'd6f54db0', - 'rsrc/js/application/transactions/behavior-show-older-transactions.js' => 'c30ccda9', + 'rsrc/js/application/transactions/behavior-show-older-transactions.js' => '83458cbb', 'rsrc/js/application/transactions/behavior-transaction-comment-form.js' => '9f7309fb', 'rsrc/js/application/transactions/behavior-transaction-list.js' => '13c739ea', 'rsrc/js/application/uiexample/JavelinViewExample.js' => 'd4a14807', @@ -625,7 +625,7 @@ return array( 'javelin-behavior-phabricator-reveal-content' => '60821bc7', 'javelin-behavior-phabricator-search-typeahead' => '724b1247', 'javelin-behavior-phabricator-show-all-transactions' => '7c273581', - 'javelin-behavior-phabricator-show-older-transactions' => 'c30ccda9', + 'javelin-behavior-phabricator-show-older-transactions' => '83458cbb', 'javelin-behavior-phabricator-tooltips' => '3ee3408b', 'javelin-behavior-phabricator-transaction-comment-form' => '9f7309fb', 'javelin-behavior-phabricator-transaction-list' => '13c739ea', @@ -1375,6 +1375,12 @@ return array( '82ce2142' => array( 'aphront-typeahead-control-css', ), + '83458cbb' => array( + 'javelin-behavior', + 'javelin-stratcom', + 'javelin-dom', + 'phabricator-busy', + ), '84845b5b' => array( 'javelin-behavior', 'javelin-dom', @@ -1668,12 +1674,6 @@ return array( 'javelin-util', 'phabricator-shaped-request', ), - 'c30ccda9' => array( - 'javelin-behavior', - 'javelin-stratcom', - 'javelin-dom', - 'phabricator-busy', - ), 'c4569c05' => array( 'javelin-magical-init', 'javelin-install', diff --git a/src/applications/almanac/storage/AlmanacBinding.php b/src/applications/almanac/storage/AlmanacBinding.php index 75d78a24aa..0cca45e961 100644 --- a/src/applications/almanac/storage/AlmanacBinding.php +++ b/src/applications/almanac/storage/AlmanacBinding.php @@ -184,4 +184,11 @@ final class AlmanacBinding return new AlmanacBindingTransaction(); } + public function willRenderTimeline( + PhabricatorApplicationTransactionView $timeline, + AphrontRequest $request) { + + return $timeline; + } + } diff --git a/src/applications/almanac/storage/AlmanacDevice.php b/src/applications/almanac/storage/AlmanacDevice.php index 9075c1fd7e..692206f0dd 100644 --- a/src/applications/almanac/storage/AlmanacDevice.php +++ b/src/applications/almanac/storage/AlmanacDevice.php @@ -162,6 +162,13 @@ final class AlmanacDevice return new AlmanacDeviceTransaction(); } + public function willRenderTimeline( + PhabricatorApplicationTransactionView $timeline, + AphrontRequest $request) { + + return $timeline; + } + /* -( PhabricatorSSHPublicKeyInterface )----------------------------------- */ diff --git a/src/applications/almanac/storage/AlmanacNetwork.php b/src/applications/almanac/storage/AlmanacNetwork.php index e91bab4cf4..663f815e02 100644 --- a/src/applications/almanac/storage/AlmanacNetwork.php +++ b/src/applications/almanac/storage/AlmanacNetwork.php @@ -59,6 +59,13 @@ final class AlmanacNetwork return new AlmanacNetworkTransaction(); } + public function willRenderTimeline( + PhabricatorApplicationTransactionView $timeline, + AphrontRequest $request) { + + return $timeline; + } + /* -( PhabricatorPolicyInterface )----------------------------------------- */ diff --git a/src/applications/almanac/storage/AlmanacService.php b/src/applications/almanac/storage/AlmanacService.php index 0d15afb15e..b058c116be 100644 --- a/src/applications/almanac/storage/AlmanacService.php +++ b/src/applications/almanac/storage/AlmanacService.php @@ -161,4 +161,11 @@ final class AlmanacService return new AlmanacServiceTransaction(); } + public function willRenderTimeline( + PhabricatorApplicationTransactionView $timeline, + AphrontRequest $request) { + + return $timeline; + } + } diff --git a/src/applications/auth/storage/PhabricatorAuthProviderConfig.php b/src/applications/auth/storage/PhabricatorAuthProviderConfig.php index 3ae36034c3..957e195fbc 100644 --- a/src/applications/auth/storage/PhabricatorAuthProviderConfig.php +++ b/src/applications/auth/storage/PhabricatorAuthProviderConfig.php @@ -97,6 +97,13 @@ final class PhabricatorAuthProviderConfig return new PhabricatorAuthProviderConfigTransaction(); } + public function willRenderTimeline( + PhabricatorApplicationTransactionView $timeline, + AphrontRequest $request) { + + return $timeline; + } + /* -( PhabricatorPolicyInterface )----------------------------------------- */ diff --git a/src/applications/base/controller/PhabricatorController.php b/src/applications/base/controller/PhabricatorController.php index 81348a9bc7..d2f172fc72 100644 --- a/src/applications/base/controller/PhabricatorController.php +++ b/src/applications/base/controller/PhabricatorController.php @@ -529,7 +529,8 @@ abstract class PhabricatorController extends AphrontController { 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 @@ abstract class PhabricatorController extends AphrontController { ->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/config/storage/PhabricatorConfigEntry.php b/src/applications/config/storage/PhabricatorConfigEntry.php index 736b4facac..54fac1e333 100644 --- a/src/applications/config/storage/PhabricatorConfigEntry.php +++ b/src/applications/config/storage/PhabricatorConfigEntry.php @@ -68,6 +68,13 @@ final class PhabricatorConfigEntry return new PhabricatorConfigTransaction(); } + public function willRenderTimeline( + PhabricatorApplicationTransactionView $timeline, + AphrontRequest $request) { + + return $timeline; + } + /* -( PhabricatorPolicyInterface )----------------------------------------- */ diff --git a/src/applications/dashboard/storage/PhabricatorDashboard.php b/src/applications/dashboard/storage/PhabricatorDashboard.php index 1dd06b851a..2b5dd29d53 100644 --- a/src/applications/dashboard/storage/PhabricatorDashboard.php +++ b/src/applications/dashboard/storage/PhabricatorDashboard.php @@ -99,6 +99,13 @@ final class PhabricatorDashboard extends PhabricatorDashboardDAO return new PhabricatorDashboardTransaction(); } + public function willRenderTimeline( + PhabricatorApplicationTransactionView $timeline, + AphrontRequest $request) { + + return $timeline; + } + /* -( PhabricatorPolicyInterface )----------------------------------------- */ diff --git a/src/applications/dashboard/storage/PhabricatorDashboardPanel.php b/src/applications/dashboard/storage/PhabricatorDashboardPanel.php index a18c1c8f98..bf86cb2ac0 100644 --- a/src/applications/dashboard/storage/PhabricatorDashboardPanel.php +++ b/src/applications/dashboard/storage/PhabricatorDashboardPanel.php @@ -105,6 +105,13 @@ final class PhabricatorDashboardPanel return new PhabricatorDashboardPanelTransaction(); } + public function willRenderTimeline( + PhabricatorApplicationTransactionView $timeline, + AphrontRequest $request) { + + return $timeline; + } + /* -( PhabricatorPolicyInterface )----------------------------------------- */ diff --git a/src/applications/differential/controller/DifferentialRevisionViewController.php b/src/applications/differential/controller/DifferentialRevisionViewController.php index 85faa55ce7..21e9c7ffc2 100644 --- a/src/applications/differential/controller/DifferentialRevisionViewController.php +++ b/src/applications/differential/controller/DifferentialRevisionViewController.php @@ -928,12 +928,12 @@ final class DifferentialRevisionViewController extends DifferentialController { $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/DifferentialDiff.php b/src/applications/differential/storage/DifferentialDiff.php index abb677287f..f055000fdb 100644 --- a/src/applications/differential/storage/DifferentialDiff.php +++ b/src/applications/differential/storage/DifferentialDiff.php @@ -421,11 +421,9 @@ final class DifferentialDiff public function getApplicationTransactionEditor() { - return new DifferentialDiffEditor(); } - public function getApplicationTransactionObject() { return $this; } @@ -434,6 +432,13 @@ final class DifferentialDiff return new DifferentialDiffTransaction(); } + public function willRenderTimeline( + PhabricatorApplicationTransactionView $timeline, + AphrontRequest $request) { + + return $timeline; + } + /* -( PhabricatorDestructibleInterface )----------------------------------- */ diff --git a/src/applications/differential/storage/DifferentialRevision.php b/src/applications/differential/storage/DifferentialRevision.php index f33ba47526..22cf0d2b3c 100644 --- a/src/applications/differential/storage/DifferentialRevision.php +++ b/src/applications/differential/storage/DifferentialRevision.php @@ -475,6 +475,35 @@ final class DifferentialRevision extends DifferentialDAO 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/drydock/storage/DrydockBlueprint.php b/src/applications/drydock/storage/DrydockBlueprint.php index f2f45c1213..e7c0d63eb2 100644 --- a/src/applications/drydock/storage/DrydockBlueprint.php +++ b/src/applications/drydock/storage/DrydockBlueprint.php @@ -91,6 +91,13 @@ final class DrydockBlueprint extends DrydockDAO return new DrydockBlueprintTransaction(); } + public function willRenderTimeline( + PhabricatorApplicationTransactionView $timeline, + AphrontRequest $request) { + + return $timeline; + } + /* -( PhabricatorPolicyInterface )----------------------------------------- */ diff --git a/src/applications/files/storage/PhabricatorFile.php b/src/applications/files/storage/PhabricatorFile.php index fff4abddbd..1a4214a0c7 100644 --- a/src/applications/files/storage/PhabricatorFile.php +++ b/src/applications/files/storage/PhabricatorFile.php @@ -1095,6 +1095,13 @@ final class PhabricatorFile extends PhabricatorFileDAO return new PhabricatorFileTransaction(); } + public function willRenderTimeline( + PhabricatorApplicationTransactionView $timeline, + AphrontRequest $request) { + + return $timeline; + } + /* -( PhabricatorPolicyInterface Implementation )-------------------------- */ diff --git a/src/applications/fund/storage/FundBacker.php b/src/applications/fund/storage/FundBacker.php index dd66f8cd6e..d9543bb225 100644 --- a/src/applications/fund/storage/FundBacker.php +++ b/src/applications/fund/storage/FundBacker.php @@ -118,4 +118,11 @@ final class FundBacker extends FundDAO return new FundBackerTransaction(); } + public function willRenderTimeline( + PhabricatorApplicationTransactionView $timeline, + AphrontRequest $request) { + + return $timeline; + } + } diff --git a/src/applications/fund/storage/FundInitiative.php b/src/applications/fund/storage/FundInitiative.php index 8893c05619..1a266e3047 100644 --- a/src/applications/fund/storage/FundInitiative.php +++ b/src/applications/fund/storage/FundInitiative.php @@ -149,6 +149,13 @@ final class FundInitiative extends FundDAO return new FundInitiativeTransaction(); } + public function willRenderTimeline( + PhabricatorApplicationTransactionView $timeline, + AphrontRequest $request) { + + return $timeline; + } + /* -( PhabricatorSubscribableInterface )----------------------------------- */ diff --git a/src/applications/harbormaster/storage/HarbormasterBuildable.php b/src/applications/harbormaster/storage/HarbormasterBuildable.php index 17cfd8350f..3026837628 100644 --- a/src/applications/harbormaster/storage/HarbormasterBuildable.php +++ b/src/applications/harbormaster/storage/HarbormasterBuildable.php @@ -242,6 +242,13 @@ final class HarbormasterBuildable extends HarbormasterDAO return new HarbormasterBuildableTransaction(); } + public function willRenderTimeline( + PhabricatorApplicationTransactionView $timeline, + AphrontRequest $request) { + + return $timeline; + } + /* -( PhabricatorPolicyInterface )----------------------------------------- */ diff --git a/src/applications/harbormaster/storage/build/HarbormasterBuild.php b/src/applications/harbormaster/storage/build/HarbormasterBuild.php index db8cbd2818..3f4295e45e 100644 --- a/src/applications/harbormaster/storage/build/HarbormasterBuild.php +++ b/src/applications/harbormaster/storage/build/HarbormasterBuild.php @@ -419,6 +419,13 @@ final class HarbormasterBuild extends HarbormasterDAO return new HarbormasterBuildTransaction(); } + public function willRenderTimeline( + PhabricatorApplicationTransactionView $timeline, + AphrontRequest $request) { + + return $timeline; + } + /* -( PhabricatorPolicyInterface )----------------------------------------- */ diff --git a/src/applications/harbormaster/storage/configuration/HarbormasterBuildPlan.php b/src/applications/harbormaster/storage/configuration/HarbormasterBuildPlan.php index 3475f00a4f..594ad3c9d4 100644 --- a/src/applications/harbormaster/storage/configuration/HarbormasterBuildPlan.php +++ b/src/applications/harbormaster/storage/configuration/HarbormasterBuildPlan.php @@ -85,6 +85,13 @@ final class HarbormasterBuildPlan extends HarbormasterDAO return new HarbormasterBuildPlanTransaction(); } + public function willRenderTimeline( + PhabricatorApplicationTransactionView $timeline, + AphrontRequest $request) { + + return $timeline; + } + /* -( PhabricatorPolicyInterface )----------------------------------------- */ diff --git a/src/applications/harbormaster/storage/configuration/HarbormasterBuildStep.php b/src/applications/harbormaster/storage/configuration/HarbormasterBuildStep.php index 858b57abc8..92b8e69ccf 100644 --- a/src/applications/harbormaster/storage/configuration/HarbormasterBuildStep.php +++ b/src/applications/harbormaster/storage/configuration/HarbormasterBuildStep.php @@ -104,6 +104,13 @@ final class HarbormasterBuildStep extends HarbormasterDAO return new HarbormasterBuildStepTransaction(); } + public function willRenderTimeline( + PhabricatorApplicationTransactionView $timeline, + AphrontRequest $request) { + + return $timeline; + } + /* -( PhabricatorPolicyInterface )----------------------------------------- */ diff --git a/src/applications/herald/storage/HeraldRule.php b/src/applications/herald/storage/HeraldRule.php index 95908714cb..6289ac8797 100644 --- a/src/applications/herald/storage/HeraldRule.php +++ b/src/applications/herald/storage/HeraldRule.php @@ -265,8 +265,10 @@ final class HeraldRule extends HeraldDAO return sprintf('~%d%010d', $type_order, $this->getID()); } + /* -( PhabricatorApplicationTransactionInterface )------------------------- */ + public function getApplicationTransactionEditor() { return new HeraldRuleEditor(); } @@ -279,6 +281,14 @@ final class HeraldRule extends HeraldDAO return new HeraldRuleTransaction(); } + public function willRenderTimeline( + PhabricatorApplicationTransactionView $timeline, + AphrontRequest $request) { + + return $timeline; + } + + /* -( PhabricatorPolicyInterface )----------------------------------------- */ diff --git a/src/applications/legalpad/storage/LegalpadDocument.php b/src/applications/legalpad/storage/LegalpadDocument.php index ca3b035cb0..e518e3be5f 100644 --- a/src/applications/legalpad/storage/LegalpadDocument.php +++ b/src/applications/legalpad/storage/LegalpadDocument.php @@ -213,6 +213,13 @@ final class LegalpadDocument extends LegalpadDAO return new LegalpadTransaction(); } + public function willRenderTimeline( + PhabricatorApplicationTransactionView $timeline, + AphrontRequest $request) { + + return $timeline; + } + /* -( PhabricatorDestructibleInterface )----------------------------------- */ diff --git a/src/applications/macro/storage/PhabricatorFileImageMacro.php b/src/applications/macro/storage/PhabricatorFileImageMacro.php index f5122dd687..34ecfb26c1 100644 --- a/src/applications/macro/storage/PhabricatorFileImageMacro.php +++ b/src/applications/macro/storage/PhabricatorFileImageMacro.php @@ -95,6 +95,13 @@ final class PhabricatorFileImageMacro extends PhabricatorFileDAO return new PhabricatorMacroTransaction(); } + public function willRenderTimeline( + PhabricatorApplicationTransactionView $timeline, + AphrontRequest $request) { + + return $timeline; + } + /* -( PhabricatorSubscribableInterface )----------------------------------- */ diff --git a/src/applications/maniphest/storage/ManiphestTask.php b/src/applications/maniphest/storage/ManiphestTask.php index 6661b13f97..1ffe915b8a 100644 --- a/src/applications/maniphest/storage/ManiphestTask.php +++ b/src/applications/maniphest/storage/ManiphestTask.php @@ -374,4 +374,11 @@ final class ManiphestTask extends ManiphestDAO return new ManiphestTransaction(); } + public function willRenderTimeline( + PhabricatorApplicationTransactionView $timeline, + AphrontRequest $request) { + + return $timeline; + } + } diff --git a/src/applications/nuance/storage/NuanceSource.php b/src/applications/nuance/storage/NuanceSource.php index 0bf955a875..ecf2f7bba8 100644 --- a/src/applications/nuance/storage/NuanceSource.php +++ b/src/applications/nuance/storage/NuanceSource.php @@ -82,6 +82,13 @@ final class NuanceSource extends NuanceDAO return new NuanceSourceTransaction(); } + public function willRenderTimeline( + PhabricatorApplicationTransactionView $timeline, + AphrontRequest $request) { + + return $timeline; + } + public function getCapabilities() { return array( diff --git a/src/applications/passphrase/storage/PassphraseCredential.php b/src/applications/passphrase/storage/PassphraseCredential.php index ae1fe9d49a..976a379f1a 100644 --- a/src/applications/passphrase/storage/PassphraseCredential.php +++ b/src/applications/passphrase/storage/PassphraseCredential.php @@ -98,6 +98,13 @@ final class PassphraseCredential extends PassphraseDAO return new PassphraseCredentialTransaction(); } + public function willRenderTimeline( + PhabricatorApplicationTransactionView $timeline, + AphrontRequest $request) { + + return $timeline; + } + /* -( PhabricatorPolicyInterface )----------------------------------------- */ diff --git a/src/applications/paste/storage/PhabricatorPaste.php b/src/applications/paste/storage/PhabricatorPaste.php index 02f37853af..a2b478a8f6 100644 --- a/src/applications/paste/storage/PhabricatorPaste.php +++ b/src/applications/paste/storage/PhabricatorPaste.php @@ -194,4 +194,11 @@ final class PhabricatorPaste extends PhabricatorPasteDAO return new PhabricatorPasteTransaction(); } + public function willRenderTimeline( + PhabricatorApplicationTransactionView $timeline, + AphrontRequest $request) { + + return $timeline; + } + } diff --git a/src/applications/phlux/storage/PhluxVariable.php b/src/applications/phlux/storage/PhluxVariable.php index 845bb27b63..7a356b8c44 100644 --- a/src/applications/phlux/storage/PhluxVariable.php +++ b/src/applications/phlux/storage/PhluxVariable.php @@ -49,6 +49,13 @@ final class PhluxVariable extends PhluxDAO return new PhluxTransaction(); } + public function willRenderTimeline( + PhabricatorApplicationTransactionView $timeline, + AphrontRequest $request) { + + return $timeline; + } + /* -( PhabricatorPolicyInterface )----------------------------------------- */ diff --git a/src/applications/pholio/storage/PholioMock.php b/src/applications/pholio/storage/PholioMock.php index e4a574d480..bea0f3ceb8 100644 --- a/src/applications/pholio/storage/PholioMock.php +++ b/src/applications/pholio/storage/PholioMock.php @@ -264,6 +264,13 @@ final class PholioMock extends PholioDAO return new PholioTransaction(); } + public function willRenderTimeline( + PhabricatorApplicationTransactionView $timeline, + AphrontRequest $request) { + + $timeline->setMock($this); + return $timeline; + } /* -( PhabricatorTokenReceiverInterface )---------------------------------- */ diff --git a/src/applications/phortune/storage/PhortuneAccount.php b/src/applications/phortune/storage/PhortuneAccount.php index 30f9027eea..3bb380e151 100644 --- a/src/applications/phortune/storage/PhortuneAccount.php +++ b/src/applications/phortune/storage/PhortuneAccount.php @@ -112,6 +112,13 @@ final class PhortuneAccount extends PhortuneDAO return new PhortuneAccountTransaction(); } + public function willRenderTimeline( + PhabricatorApplicationTransactionView $timeline, + AphrontRequest $request) { + + return $timeline; + } + /* -( PhabricatorPolicyInterface )----------------------------------------- */ diff --git a/src/applications/phortune/storage/PhortuneCart.php b/src/applications/phortune/storage/PhortuneCart.php index b90223253b..31eb3a4b88 100644 --- a/src/applications/phortune/storage/PhortuneCart.php +++ b/src/applications/phortune/storage/PhortuneCart.php @@ -614,6 +614,13 @@ final class PhortuneCart extends PhortuneDAO return new PhortuneCartTransaction(); } + public function willRenderTimeline( + PhabricatorApplicationTransactionView $timeline, + AphrontRequest $request) { + + return $timeline; + } + /* -( PhabricatorPolicyInterface )----------------------------------------- */ diff --git a/src/applications/phortune/storage/PhortuneMerchant.php b/src/applications/phortune/storage/PhortuneMerchant.php index 05dbb00ebb..ce4cd4466d 100644 --- a/src/applications/phortune/storage/PhortuneMerchant.php +++ b/src/applications/phortune/storage/PhortuneMerchant.php @@ -57,6 +57,13 @@ final class PhortuneMerchant extends PhortuneDAO return new PhortuneMerchantTransaction(); } + public function willRenderTimeline( + PhabricatorApplicationTransactionView $timeline, + AphrontRequest $request) { + + return $timeline; + } + /* -( PhabricatorPolicyInterface )----------------------------------------- */ diff --git a/src/applications/phriction/storage/PhrictionDocument.php b/src/applications/phriction/storage/PhrictionDocument.php index fe1ed78a48..a950852795 100644 --- a/src/applications/phriction/storage/PhrictionDocument.php +++ b/src/applications/phriction/storage/PhrictionDocument.php @@ -216,6 +216,12 @@ final class PhrictionDocument extends PhrictionDAO return new PhrictionTransaction(); } + public function willRenderTimeline( + PhabricatorApplicationTransactionView $timeline, + AphrontRequest $request) { + + return $timeline; + } /* -( PhabricatorTokenReceiverInterface )---------------------------------- */ diff --git a/src/applications/ponder/storage/PonderAnswer.php b/src/applications/ponder/storage/PonderAnswer.php index 6cdf079d45..7e6cdbd19e 100644 --- a/src/applications/ponder/storage/PonderAnswer.php +++ b/src/applications/ponder/storage/PonderAnswer.php @@ -129,6 +129,13 @@ final class PonderAnswer extends PonderDAO return new PonderAnswerTransaction(); } + public function willRenderTimeline( + PhabricatorApplicationTransactionView $timeline, + AphrontRequest $request) { + + return $timeline; + } + // Markup interface diff --git a/src/applications/ponder/storage/PonderQuestion.php b/src/applications/ponder/storage/PonderQuestion.php index abeda5e98c..6237f48c9a 100644 --- a/src/applications/ponder/storage/PonderQuestion.php +++ b/src/applications/ponder/storage/PonderQuestion.php @@ -161,6 +161,13 @@ final class PonderQuestion extends PonderDAO return new PonderQuestionTransaction(); } + public function willRenderTimeline( + PhabricatorApplicationTransactionView $timeline, + AphrontRequest $request) { + + return $timeline; + } + // Markup interface diff --git a/src/applications/project/storage/PhabricatorProject.php b/src/applications/project/storage/PhabricatorProject.php index 42e2b578e7..0274bd2930 100644 --- a/src/applications/project/storage/PhabricatorProject.php +++ b/src/applications/project/storage/PhabricatorProject.php @@ -375,6 +375,13 @@ final class PhabricatorProject extends PhabricatorProjectDAO return new PhabricatorProjectTransaction(); } + public function willRenderTimeline( + PhabricatorApplicationTransactionView $timeline, + AphrontRequest $request) { + + return $timeline; + } + /* -( PhabricatorDestructibleInterface )----------------------------------- */ diff --git a/src/applications/project/storage/PhabricatorProjectColumn.php b/src/applications/project/storage/PhabricatorProjectColumn.php index 12e89713c1..de6a1cc35d 100644 --- a/src/applications/project/storage/PhabricatorProjectColumn.php +++ b/src/applications/project/storage/PhabricatorProjectColumn.php @@ -151,6 +151,13 @@ final class PhabricatorProjectColumn return new PhabricatorProjectColumnTransaction(); } + public function willRenderTimeline( + PhabricatorApplicationTransactionView $timeline, + AphrontRequest $request) { + + return $timeline; + } + /* -( PhabricatorPolicyInterface )----------------------------------------- */ diff --git a/src/applications/releeph/storage/ReleephBranch.php b/src/applications/releeph/storage/ReleephBranch.php index bc83b5e0a2..c4f4fabc04 100644 --- a/src/applications/releeph/storage/ReleephBranch.php +++ b/src/applications/releeph/storage/ReleephBranch.php @@ -166,6 +166,13 @@ final class ReleephBranch extends ReleephDAO return new ReleephBranchTransaction(); } + public function willRenderTimeline( + PhabricatorApplicationTransactionView $timeline, + AphrontRequest $request) { + + return $timeline; + } + /* -( PhabricatorPolicyInterface )----------------------------------------- */ diff --git a/src/applications/releeph/storage/ReleephProject.php b/src/applications/releeph/storage/ReleephProject.php index b92e78afaa..d5270f4024 100644 --- a/src/applications/releeph/storage/ReleephProject.php +++ b/src/applications/releeph/storage/ReleephProject.php @@ -139,6 +139,13 @@ final class ReleephProject extends ReleephDAO return new ReleephProductTransaction(); } + public function willRenderTimeline( + PhabricatorApplicationTransactionView $timeline, + AphrontRequest $request) { + + return $timeline; + } + /* -( PhabricatorPolicyInterface )----------------------------------------- */ diff --git a/src/applications/releeph/storage/ReleephRequest.php b/src/applications/releeph/storage/ReleephRequest.php index a29bdee3f7..22a6270a2b 100644 --- a/src/applications/releeph/storage/ReleephRequest.php +++ b/src/applications/releeph/storage/ReleephRequest.php @@ -312,6 +312,13 @@ final class ReleephRequest extends ReleephDAO return new ReleephRequestTransaction(); } + public function willRenderTimeline( + PhabricatorApplicationTransactionView $timeline, + AphrontRequest $request) { + + return $timeline; + } + /* -( PhabricatorPolicyInterface )----------------------------------------- */ diff --git a/src/applications/repository/storage/PhabricatorRepository.php b/src/applications/repository/storage/PhabricatorRepository.php index ceae8cbf2e..bf60744b55 100644 --- a/src/applications/repository/storage/PhabricatorRepository.php +++ b/src/applications/repository/storage/PhabricatorRepository.php @@ -1528,6 +1528,13 @@ final class PhabricatorRepository extends PhabricatorRepositoryDAO return new PhabricatorRepositoryTransaction(); } + public function willRenderTimeline( + PhabricatorApplicationTransactionView $timeline, + AphrontRequest $request) { + + return $timeline; + } + /* -( PhabricatorPolicyInterface )----------------------------------------- */ diff --git a/src/applications/repository/storage/PhabricatorRepositoryCommit.php b/src/applications/repository/storage/PhabricatorRepositoryCommit.php index 2a3c4551bb..92d5df0da6 100644 --- a/src/applications/repository/storage/PhabricatorRepositoryCommit.php +++ b/src/applications/repository/storage/PhabricatorRepositoryCommit.php @@ -402,4 +402,11 @@ final class PhabricatorRepositoryCommit return new PhabricatorAuditTransaction(); } + public function willRenderTimeline( + PhabricatorApplicationTransactionView $timeline, + AphrontRequest $request) { + + return $timeline; + } + } diff --git a/src/applications/slowvote/storage/PhabricatorSlowvotePoll.php b/src/applications/slowvote/storage/PhabricatorSlowvotePoll.php index 352ff42948..5bea424ffa 100644 --- a/src/applications/slowvote/storage/PhabricatorSlowvotePoll.php +++ b/src/applications/slowvote/storage/PhabricatorSlowvotePoll.php @@ -119,6 +119,13 @@ final class PhabricatorSlowvotePoll extends PhabricatorSlowvoteDAO return new PhabricatorSlowvoteTransaction(); } + public function willRenderTimeline( + PhabricatorApplicationTransactionView $timeline, + AphrontRequest $request) { + + return $timeline; + } + /* -( PhabricatorPolicyInterface )----------------------------------------- */ diff --git a/src/applications/transactions/interface/PhabricatorApplicationTransactionInterface.php b/src/applications/transactions/interface/PhabricatorApplicationTransactionInterface.php index 1c6b4a0049..fdccf7b775 100644 --- a/src/applications/transactions/interface/PhabricatorApplicationTransactionInterface.php +++ b/src/applications/transactions/interface/PhabricatorApplicationTransactionInterface.php @@ -35,6 +35,15 @@ interface PhabricatorApplicationTransactionInterface { */ public function getApplicationTransactionTemplate(); + /** + * Hook to augment the $timeline with additional data for rendering. + * + * @return PhabricatorApplicationTransactionView + */ + public function willRenderTimeline( + PhabricatorApplicationTransactionView $timeline, + AphrontRequest $request); + } // TEMPLATE IMPLEMENTATION ///////////////////////////////////////////////////// @@ -55,4 +64,11 @@ interface PhabricatorApplicationTransactionInterface { 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 index 531a3eba70..ce57de1849 100644 --- a/src/applications/transactions/view/PhabricatorApplicationTransactionView.php +++ b/src/applications/transactions/view/PhabricatorApplicationTransactionView.php @@ -14,6 +14,7 @@ class PhabricatorApplicationTransactionView extends AphrontView { private $quoteTargetID; private $quoteRef; private $pager; + private $renderData = array(); public function setQuoteRef($quote_ref) { $this->quoteRef = $quote_ref; @@ -85,6 +86,21 @@ class PhabricatorApplicationTransactionView extends AphrontView { 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 @@ class PhabricatorApplicationTransactionView extends AphrontView { 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 index df8007de8c..376f747353 100644 --- a/src/view/phui/PHUITimelineView.php +++ b/src/view/phui/PHUITimelineView.php @@ -7,6 +7,7 @@ final class PHUITimelineView extends AphrontView { private $shouldTerminate = false; private $shouldAddSpacers = true; private $pager; + private $renderData = array(); public function setID($id) { $this->id = $id; @@ -37,6 +38,11 @@ final class PHUITimelineView extends AphrontView { 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 @@ final class PHUITimelineView extends AphrontView { '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 index 112eac1612..294d84337d 100644 --- 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 @@ JX.behavior('phabricator-show-older-transactions', function(config) { }; 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)); };