1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-21 21:10:56 +01:00

Transactions - deploy buildTransactionTimeline to remaining applications

Summary:
Ref T4712. Specifically...

- Differential
 - needed getApplicationTransactionViewObject() implemented
- Audit
 - needed getApplicationTransactionViewObject() implemented
- Repository
 - one object needed PhabricatorApplicationTransactionInterface implemented
 - setShouldTerminate(true)
- Ponder
 - BONUS BUG FIX - leaving a comment on an answer had a bad redirect URI
 - both PonderQuestion and PonderAnswer needed PhabricatorApplicationTransactionInterface implemented
 - setShouldTerminate(true) on both "history" controllers
 - left a "TODO" on buildAnswers on the question view controller, which is non-standard and should be re-written eventually
- Phortune
 - BONUS BUG FIX - fix new user "createNewAccount" code to not fatal
 - PhortuneAccount, PhortuneMerchant, and PhortuneCart needed PhabricatorApplicationTransactionInterface implemented
 - setShouldTerminate(true) on Account view, merchant view, and cart view controller
- Fund
- Legalpad
- Nuance
  - NuanceSource needed PhabricatorApplicationTransactionInterface implemented
- Releeph (this product is kind of a mess...)
  - HACKQUEST - had to manually create an arcanist project to even be able to make a "product" and get started...!
  - BONUS BUG FIX - make sure to "setName" on product edit
  - ReleephProject (should be ReleepProduct...?), ReleephBranch, and ReleepRequest needed PhabricatorApplicationTransactionInterface implemented
- Harbormaster
  - HarbormasterBuildable, HarbormasterBuild, HarbormasterBuildPlan, and HarbormasterBuildStep all needed PhabricatorApplicationTransactionInterface implemented
  - setShouldTerminate(true) all over the place

Test Plan: foreach application, viewed the timeline(s) and made sure they still rendered

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin, epriestley

Maniphest Tasks: T4712

Differential Revision: https://secure.phabricator.com/D10925
This commit is contained in:
Bob Trahan 2014-12-03 15:35:47 -08:00
parent 5e8600442d
commit f6e635c8d2
39 changed files with 377 additions and 265 deletions

View file

@ -3789,6 +3789,7 @@ phutil_register_library_map(array(
'FundSchemaSpec' => 'PhabricatorConfigSchemaSpec', 'FundSchemaSpec' => 'PhabricatorConfigSchemaSpec',
'HarbormasterBuild' => array( 'HarbormasterBuild' => array(
'HarbormasterDAO', 'HarbormasterDAO',
'PhabricatorApplicationTransactionInterface',
'PhabricatorPolicyInterface', 'PhabricatorPolicyInterface',
), ),
'HarbormasterBuildAbortedException' => 'Exception', 'HarbormasterBuildAbortedException' => 'Exception',
@ -3820,6 +3821,7 @@ phutil_register_library_map(array(
'HarbormasterBuildPHIDType' => 'PhabricatorPHIDType', 'HarbormasterBuildPHIDType' => 'PhabricatorPHIDType',
'HarbormasterBuildPlan' => array( 'HarbormasterBuildPlan' => array(
'HarbormasterDAO', 'HarbormasterDAO',
'PhabricatorApplicationTransactionInterface',
'PhabricatorPolicyInterface', 'PhabricatorPolicyInterface',
'PhabricatorSubscribableInterface', 'PhabricatorSubscribableInterface',
), ),
@ -3833,6 +3835,7 @@ phutil_register_library_map(array(
'HarbormasterBuildQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', 'HarbormasterBuildQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
'HarbormasterBuildStep' => array( 'HarbormasterBuildStep' => array(
'HarbormasterDAO', 'HarbormasterDAO',
'PhabricatorApplicationTransactionInterface',
'PhabricatorPolicyInterface', 'PhabricatorPolicyInterface',
'PhabricatorCustomFieldInterface', 'PhabricatorCustomFieldInterface',
), ),
@ -3859,6 +3862,7 @@ phutil_register_library_map(array(
'HarbormasterBuildWorker' => 'HarbormasterWorker', 'HarbormasterBuildWorker' => 'HarbormasterWorker',
'HarbormasterBuildable' => array( 'HarbormasterBuildable' => array(
'HarbormasterDAO', 'HarbormasterDAO',
'PhabricatorApplicationTransactionInterface',
'PhabricatorPolicyInterface', 'PhabricatorPolicyInterface',
'HarbormasterBuildableInterface', 'HarbormasterBuildableInterface',
), ),
@ -4154,6 +4158,7 @@ phutil_register_library_map(array(
'NuanceSchemaSpec' => 'PhabricatorConfigSchemaSpec', 'NuanceSchemaSpec' => 'PhabricatorConfigSchemaSpec',
'NuanceSource' => array( 'NuanceSource' => array(
'NuanceDAO', 'NuanceDAO',
'PhabricatorApplicationTransactionInterface',
'PhabricatorPolicyInterface', 'PhabricatorPolicyInterface',
), ),
'NuanceSourceDefaultEditCapability' => 'PhabricatorPolicyCapability', 'NuanceSourceDefaultEditCapability' => 'PhabricatorPolicyCapability',
@ -5312,6 +5317,7 @@ phutil_register_library_map(array(
'PhabricatorRepositoriesApplication' => 'PhabricatorApplication', 'PhabricatorRepositoriesApplication' => 'PhabricatorApplication',
'PhabricatorRepository' => array( 'PhabricatorRepository' => array(
'PhabricatorRepositoryDAO', 'PhabricatorRepositoryDAO',
'PhabricatorApplicationTransactionInterface',
'PhabricatorPolicyInterface', 'PhabricatorPolicyInterface',
'PhabricatorFlaggableInterface', 'PhabricatorFlaggableInterface',
'PhabricatorMarkupInterface', 'PhabricatorMarkupInterface',
@ -5837,6 +5843,7 @@ phutil_register_library_map(array(
'PholioUploadedImageView' => 'AphrontView', 'PholioUploadedImageView' => 'AphrontView',
'PhortuneAccount' => array( 'PhortuneAccount' => array(
'PhortuneDAO', 'PhortuneDAO',
'PhabricatorApplicationTransactionInterface',
'PhabricatorPolicyInterface', 'PhabricatorPolicyInterface',
), ),
'PhortuneAccountEditController' => 'PhortuneController', 'PhortuneAccountEditController' => 'PhortuneController',
@ -5851,6 +5858,7 @@ phutil_register_library_map(array(
'PhortuneBalancedPaymentProvider' => 'PhortunePaymentProvider', 'PhortuneBalancedPaymentProvider' => 'PhortunePaymentProvider',
'PhortuneCart' => array( 'PhortuneCart' => array(
'PhortuneDAO', 'PhortuneDAO',
'PhabricatorApplicationTransactionInterface',
'PhabricatorPolicyInterface', 'PhabricatorPolicyInterface',
), ),
'PhortuneCartAcceptController' => 'PhortuneCartController', 'PhortuneCartAcceptController' => 'PhortuneCartController',
@ -5887,6 +5895,7 @@ phutil_register_library_map(array(
'PhortuneMemberHasMerchantEdgeType' => 'PhabricatorEdgeType', 'PhortuneMemberHasMerchantEdgeType' => 'PhabricatorEdgeType',
'PhortuneMerchant' => array( 'PhortuneMerchant' => array(
'PhortuneDAO', 'PhortuneDAO',
'PhabricatorApplicationTransactionInterface',
'PhabricatorPolicyInterface', 'PhabricatorPolicyInterface',
), ),
'PhortuneMerchantCapability' => 'PhabricatorPolicyCapability', 'PhortuneMerchantCapability' => 'PhabricatorPolicyCapability',
@ -6056,6 +6065,7 @@ phutil_register_library_map(array(
'PonderAddAnswerView' => 'AphrontView', 'PonderAddAnswerView' => 'AphrontView',
'PonderAnswer' => array( 'PonderAnswer' => array(
'PonderDAO', 'PonderDAO',
'PhabricatorApplicationTransactionInterface',
'PhabricatorMarkupInterface', 'PhabricatorMarkupInterface',
'PonderVotableInterface', 'PonderVotableInterface',
'PhabricatorPolicyInterface', 'PhabricatorPolicyInterface',
@ -6079,6 +6089,7 @@ phutil_register_library_map(array(
'PonderEditor' => 'PhabricatorApplicationTransactionEditor', 'PonderEditor' => 'PhabricatorApplicationTransactionEditor',
'PonderQuestion' => array( 'PonderQuestion' => array(
'PonderDAO', 'PonderDAO',
'PhabricatorApplicationTransactionInterface',
'PhabricatorMarkupInterface', 'PhabricatorMarkupInterface',
'PonderVotableInterface', 'PonderVotableInterface',
'PhabricatorSubscribableInterface', 'PhabricatorSubscribableInterface',
@ -6126,6 +6137,7 @@ phutil_register_library_map(array(
'ReleephAuthorFieldSpecification' => 'ReleephFieldSpecification', 'ReleephAuthorFieldSpecification' => 'ReleephFieldSpecification',
'ReleephBranch' => array( 'ReleephBranch' => array(
'ReleephDAO', 'ReleephDAO',
'PhabricatorApplicationTransactionInterface',
'PhabricatorPolicyInterface', 'PhabricatorPolicyInterface',
), ),
'ReleephBranchAccessController' => 'ReleephBranchController', 'ReleephBranchAccessController' => 'ReleephBranchController',
@ -6183,6 +6195,7 @@ phutil_register_library_map(array(
), ),
'ReleephProject' => array( 'ReleephProject' => array(
'ReleephDAO', 'ReleephDAO',
'PhabricatorApplicationTransactionInterface',
'PhabricatorPolicyInterface', 'PhabricatorPolicyInterface',
), ),
'ReleephProjectInfoConduitAPIMethod' => 'ReleephConduitAPIMethod', 'ReleephProjectInfoConduitAPIMethod' => 'ReleephConduitAPIMethod',
@ -6192,6 +6205,7 @@ phutil_register_library_map(array(
'ReleephReasonFieldSpecification' => 'ReleephFieldSpecification', 'ReleephReasonFieldSpecification' => 'ReleephFieldSpecification',
'ReleephRequest' => array( 'ReleephRequest' => array(
'ReleephDAO', 'ReleephDAO',
'PhabricatorApplicationTransactionInterface',
'PhabricatorPolicyInterface', 'PhabricatorPolicyInterface',
'PhabricatorCustomFieldInterface', 'PhabricatorCustomFieldInterface',
), ),

View file

@ -28,6 +28,10 @@ final class PhabricatorAuditTransaction
return new PhabricatorAuditTransactionComment(); return new PhabricatorAuditTransactionComment();
} }
public function getApplicationTransactionViewObject() {
return new PhabricatorAuditTransactionView();
}
public function getRemarkupBlocks() { public function getRemarkupBlocks() {
$blocks = parent::getRemarkupBlocks(); $blocks = parent::getRemarkupBlocks();

View file

@ -926,22 +926,14 @@ final class DifferentialRevisionViewController extends DifferentialController {
DifferentialDiff $right_diff, DifferentialDiff $right_diff,
array $changesets) { array $changesets) {
$viewer = $this->getRequest()->getUser(); $timeline = $this->buildTransactionTimeline(
$revision,
$xactions = id(new DifferentialTransactionQuery()) new DifferentialTransactionQuery());
->setViewer($viewer) $timeline
->withObjectPHIDs(array($revision->getPHID()))
->needComments(true)
->execute();
$timeline = id(new DifferentialTransactionView())
->setUser($viewer)
->setObjectPHID($revision->getPHID())
->setChangesets($changesets) ->setChangesets($changesets)
->setRevision($revision) ->setRevision($revision)
->setLeftDiff($left_diff) ->setLeftDiff($left_diff)
->setRightDiff($right_diff) ->setRightDiff($right_diff);
->setTransactions($xactions);
return $timeline; return $timeline;
} }

View file

@ -31,6 +31,10 @@ final class DifferentialTransaction extends PhabricatorApplicationTransaction {
return new DifferentialTransactionComment(); return new DifferentialTransactionComment();
} }
public function getApplicationTransactionViewObject() {
return new DifferentialTransactionView();
}
public function shouldHide() { public function shouldHide() {
$old = $this->getOldValue(); $old = $this->getOldValue();
$new = $this->getNewValue(); $new = $this->getNewValue();

View file

@ -628,13 +628,10 @@ final class DiffusionCommitController extends DiffusionController {
} }
private function buildComments(PhabricatorRepositoryCommit $commit) { private function buildComments(PhabricatorRepositoryCommit $commit) {
$viewer = $this->getRequest()->getUser(); $timeline = $this->buildTransactionTimeline(
$commit,
$xactions = id(new PhabricatorAuditTransactionQuery()) new PhabricatorAuditTransactionQuery());
->setViewer($viewer) $xactions = $timeline->getTransactions();
->withObjectPHIDs(array($commit->getPHID()))
->needComments(true)
->execute();
$path_ids = array(); $path_ids = array();
foreach ($xactions as $xaction) { foreach ($xactions as $xaction) {
@ -654,11 +651,7 @@ final class DiffusionCommitController extends DiffusionController {
$path_map = ipull($path_map, 'path', 'id'); $path_map = ipull($path_map, 'path', 'id');
} }
return id(new PhabricatorAuditTransactionView()) return $timeline->setPathMap($path_map);
->setUser($viewer)
->setObjectPHID($commit->getPHID())
->setPathMap($path_map)
->setTransactions($xactions);
} }
private function renderAddCommentPanel( private function renderAddCommentPanel(

View file

@ -93,27 +93,10 @@ final class DiffusionRepositoryEditMainController
$repository, $repository,
$this->buildActionsActions($repository)); $this->buildActionsActions($repository));
$xactions = id(new PhabricatorRepositoryTransactionQuery()) $timeline = $this->buildTransactionTimeline(
->setViewer($viewer) $repository,
->withObjectPHIDs(array($repository->getPHID())) new PhabricatorRepositoryTransactionQuery());
->execute(); $timeline->setShouldTerminate(true);
$engine = id(new PhabricatorMarkupEngine())
->setViewer($viewer);
foreach ($xactions as $xaction) {
if ($xaction->getComment()) {
$engine->addObject(
$xaction->getComment(),
PhabricatorApplicationTransactionComment::MARKUP_FIELD_COMMENT);
}
}
$engine->process();
$xaction_view = id(new PhabricatorApplicationTransactionView())
->setUser($viewer)
->setObjectPHID($repository->getPHID())
->setTransactions($xactions)
->setMarkupEngine($engine);
$boxes = array(); $boxes = array();
@ -187,7 +170,7 @@ final class DiffusionRepositoryEditMainController
array( array(
$crumbs, $crumbs,
$boxes, $boxes,
$xaction_view, $timeline,
), ),
array( array(
'title' => $title, 'title' => $title,

View file

@ -60,15 +60,11 @@ final class FundInitiativeViewController
->setHeader($header) ->setHeader($header)
->appendChild($properties); ->appendChild($properties);
$xactions = id(new FundInitiativeTransactionQuery())
->setViewer($viewer)
->withObjectPHIDs(array($initiative->getPHID()))
->execute();
$timeline = id(new PhabricatorApplicationTransactionView()) $timeline = $this->buildTransactionTimeline(
->setUser($viewer) $initiative,
->setObjectPHID($initiative->getPHID()) new FundInitiativeTransactionQuery());
->setTransactions($xactions) $timeline
->setShouldTerminate(true); ->setShouldTerminate(true);
return $this->buildApplicationPage( return $this->buildApplicationPage(

View file

@ -191,14 +191,10 @@ final class HarbormasterBuildViewController
$targets[] = $this->buildLog($build, $build_target); $targets[] = $this->buildLog($build, $build_target);
} }
$xactions = id(new HarbormasterBuildTransactionQuery()) $timeline = $this->buildTransactionTimeline(
->setViewer($viewer) $build,
->withObjectPHIDs(array($build->getPHID())) new HarbormasterBuildTransactionQuery());
->execute(); $timeline->setShouldTerminate(true);
$timeline = id(new PhabricatorApplicationTransactionView())
->setUser($viewer)
->setObjectPHID($build->getPHID())
->setTransactions($xactions);
return $this->buildApplicationPage( return $this->buildApplicationPage(
array( array(

View file

@ -46,14 +46,10 @@ final class HarbormasterBuildableViewController
$box = id(new PHUIObjectBoxView()) $box = id(new PHUIObjectBoxView())
->setHeader($header); ->setHeader($header);
$xactions = id(new HarbormasterBuildableTransactionQuery()) $timeline = $this->buildTransactionTimeline(
->setViewer($viewer) $buildable,
->withObjectPHIDs(array($buildable->getPHID())) new HarbormasterBuildableTransactionQuery());
->execute(); $timeline->setShouldTerminate(true);
$timeline = id(new PhabricatorApplicationTransactionView())
->setUser($viewer)
->setObjectPHID($buildable->getPHID())
->setTransactions($xactions);
$actions = $this->buildActionList($buildable); $actions = $this->buildActionList($buildable);
$this->buildPropertyLists($box, $buildable, $actions); $this->buildPropertyLists($box, $buildable, $actions);

View file

@ -22,16 +22,10 @@ final class HarbormasterPlanViewController extends HarbormasterPlanController {
return new Aphront404Response(); return new Aphront404Response();
} }
$xactions = id(new HarbormasterBuildPlanTransactionQuery()) $timeline = $this->buildTransactionTimeline(
->setViewer($viewer) $plan,
->withObjectPHIDs(array($plan->getPHID())) new HarbormasterBuildPlanTransactionQuery());
->execute(); $timeline->setShouldTerminate(true);
$xaction_view = id(new PhabricatorApplicationTransactionView())
->setUser($viewer)
->setObjectPHID($plan->getPHID())
->setTransactions($xactions)
->setShouldTerminate(true);
$title = pht('Plan %d', $id); $title = pht('Plan %d', $id);
@ -77,7 +71,7 @@ final class HarbormasterPlanViewController extends HarbormasterPlanController {
$crumbs, $crumbs,
$box, $box,
$step_list, $step_list,
$xaction_view, $timeline,
), ),
array( array(
'title' => $title, 'title' => $title,

View file

@ -191,16 +191,10 @@ final class HarbormasterStepEditController extends HarbormasterController {
if ($is_new) { if ($is_new) {
$xaction_view = null; $xaction_view = null;
} else { } else {
$xactions = id(new HarbormasterBuildStepTransactionQuery()) $timeline = $this->buildTransactionTimeline(
->setViewer($viewer) $step,
->withObjectPHIDs(array($step->getPHID())) new HarbormasterBuildStepTransactionQuery());
->execute(); $timeline->setShouldTerminate(true);
$xaction_view = id(new PhabricatorApplicationTransactionView())
->setUser($viewer)
->setObjectPHID($step->getPHID())
->setTransactions($xactions)
->setShouldTerminate(true);
} }
return $this->buildApplicationPage( return $this->buildApplicationPage(
@ -208,7 +202,7 @@ final class HarbormasterStepEditController extends HarbormasterController {
$crumbs, $crumbs,
$box, $box,
$variables, $variables,
$xaction_view, $timeline,
), ),
array( array(
'title' => $implementation->getName(), 'title' => $implementation->getName(),

View file

@ -2,6 +2,7 @@
final class HarbormasterBuildable extends HarbormasterDAO final class HarbormasterBuildable extends HarbormasterDAO
implements implements
PhabricatorApplicationTransactionInterface,
PhabricatorPolicyInterface, PhabricatorPolicyInterface,
HarbormasterBuildableInterface { HarbormasterBuildableInterface {
@ -226,6 +227,22 @@ final class HarbormasterBuildable extends HarbormasterDAO
} }
/* -( PhabricatorApplicationTransactionInterface )------------------------- */
public function getApplicationTransactionEditor() {
return new HarbormasterBuildableTransactionEditor();
}
public function getApplicationTransactionObject() {
return $this;
}
public function getApplicationTransactionTemplate() {
return new HarbormasterBuildableTransaction();
}
/* -( PhabricatorPolicyInterface )----------------------------------------- */ /* -( PhabricatorPolicyInterface )----------------------------------------- */

View file

@ -1,7 +1,9 @@
<?php <?php
final class HarbormasterBuild extends HarbormasterDAO final class HarbormasterBuild extends HarbormasterDAO
implements PhabricatorPolicyInterface { implements
PhabricatorApplicationTransactionInterface,
PhabricatorPolicyInterface {
protected $buildablePHID; protected $buildablePHID;
protected $buildPlanPHID; protected $buildPlanPHID;
@ -402,6 +404,22 @@ final class HarbormasterBuild extends HarbormasterDAO
} }
/* -( PhabricatorApplicationTransactionInterface )------------------------- */
public function getApplicationTransactionEditor() {
return new HarbormasterBuildTransactionEditor();
}
public function getApplicationTransactionObject() {
return $this;
}
public function getApplicationTransactionTemplate() {
return new HarbormasterBuildTransaction();
}
/* -( PhabricatorPolicyInterface )----------------------------------------- */ /* -( PhabricatorPolicyInterface )----------------------------------------- */

View file

@ -2,6 +2,7 @@
final class HarbormasterBuildPlan extends HarbormasterDAO final class HarbormasterBuildPlan extends HarbormasterDAO
implements implements
PhabricatorApplicationTransactionInterface,
PhabricatorPolicyInterface, PhabricatorPolicyInterface,
PhabricatorSubscribableInterface { PhabricatorSubscribableInterface {
@ -69,6 +70,22 @@ final class HarbormasterBuildPlan extends HarbormasterDAO
} }
/* -( PhabricatorApplicationTransactionInterface )------------------------- */
public function getApplicationTransactionEditor() {
return new HarbormasterBuildPlanEditor();
}
public function getApplicationTransactionObject() {
return $this;
}
public function getApplicationTransactionTemplate() {
return new HarbormasterBuildPlanTransaction();
}
/* -( PhabricatorPolicyInterface )----------------------------------------- */ /* -( PhabricatorPolicyInterface )----------------------------------------- */

View file

@ -2,6 +2,7 @@
final class HarbormasterBuildStep extends HarbormasterDAO final class HarbormasterBuildStep extends HarbormasterDAO
implements implements
PhabricatorApplicationTransactionInterface,
PhabricatorPolicyInterface, PhabricatorPolicyInterface,
PhabricatorCustomFieldInterface { PhabricatorCustomFieldInterface {
@ -88,6 +89,22 @@ final class HarbormasterBuildStep extends HarbormasterDAO
} }
/* -( PhabricatorApplicationTransactionInterface )------------------------- */
public function getApplicationTransactionEditor() {
return new HarbormasterBuildStepEditor();
}
public function getApplicationTransactionObject() {
return $this;
}
public function getApplicationTransactionTemplate() {
return new HarbormasterBuildStepTransaction();
}
/* -( PhabricatorPolicyInterface )----------------------------------------- */ /* -( PhabricatorPolicyInterface )----------------------------------------- */

View file

@ -29,11 +29,6 @@ final class LegalpadDocumentManageController extends LegalpadController {
return new Aphront404Response(); return new Aphront404Response();
} }
$xactions = id(new LegalpadTransactionQuery())
->setViewer($user)
->withObjectPHIDs(array($document->getPHID()))
->execute();
$subscribers = PhabricatorSubscribersQuery::loadSubscribersForPHID( $subscribers = PhabricatorSubscribersQuery::loadSubscribersForPHID(
$document->getPHID()); $document->getPHID());
@ -53,14 +48,10 @@ final class LegalpadDocumentManageController extends LegalpadController {
$engine->addObject( $engine->addObject(
$document_body, $document_body,
LegalpadDocumentBody::MARKUP_FIELD_TEXT); LegalpadDocumentBody::MARKUP_FIELD_TEXT);
foreach ($xactions as $xaction) { $timeline = $this->buildTransactionTimeline(
if ($xaction->getComment()) { $document,
$engine->addObject( new LegalpadTransactionQuery(),
$xaction->getComment(), $engine);
PhabricatorApplicationTransactionComment::MARKUP_FIELD_COMMENT);
}
}
$engine->process();
$title = $document_body->getTitle(); $title = $document_body->getTitle();
@ -74,12 +65,6 @@ final class LegalpadDocumentManageController extends LegalpadController {
$comment_form_id = celerity_generate_unique_node_id(); $comment_form_id = celerity_generate_unique_node_id();
$xaction_view = id(new LegalpadTransactionView())
->setUser($this->getRequest()->getUser())
->setObjectPHID($document->getPHID())
->setTransactions($xactions)
->setMarkupEngine($engine);
$add_comment = $this->buildAddCommentView($document, $comment_form_id); $add_comment = $this->buildAddCommentView($document, $comment_form_id);
$crumbs = $this->buildApplicationCrumbs($this->buildSideNav()); $crumbs = $this->buildApplicationCrumbs($this->buildSideNav());
@ -97,7 +82,7 @@ final class LegalpadDocumentManageController extends LegalpadController {
$content = array( $content = array(
$crumbs, $crumbs,
$object_box, $object_box,
$xaction_view, $timeline,
$add_comment, $add_comment,
); );

View file

@ -31,19 +31,11 @@ final class NuanceSourceViewController extends NuanceController {
} }
$source_phid = $source->getPHID(); $source_phid = $source->getPHID();
$xactions = id(new NuanceSourceTransactionQuery())
->setViewer($viewer)
->withObjectPHIDs(array($source_phid))
->execute();
$engine = id(new PhabricatorMarkupEngine()) $timeline = $this->buildTransactionTimeline(
->setViewer($viewer); $source,
new NuanceSourceTransactionQuery());
$timeline = id(new PhabricatorApplicationTransactionView()) $timeline->setShouldTerminate(true);
->setUser($viewer)
->setObjectPHID($source_phid)
->setMarkupEngine($engine)
->setTransactions($xactions);
$title = pht('%s', $source->getName()); $title = pht('%s', $source->getName());
$crumbs = $this->buildApplicationCrumbs(); $crumbs = $this->buildApplicationCrumbs();

View file

@ -1,7 +1,9 @@
<?php <?php
final class NuanceSource extends NuanceDAO final class NuanceSource extends NuanceDAO
implements PhabricatorPolicyInterface { implements
PhabricatorApplicationTransactionInterface,
PhabricatorPolicyInterface {
protected $name; protected $name;
protected $type; protected $type;
@ -64,6 +66,23 @@ final class NuanceSource extends NuanceDAO
->setType($lucky_definition->getSourceTypeConstant()); ->setType($lucky_definition->getSourceTypeConstant());
} }
/* -( PhabricatorApplicationTransactionInterface )------------------------- */
public function getApplicationTransactionEditor() {
return new NuanceSourceEditor();
}
public function getApplicationTransactionObject() {
return $this;
}
public function getApplicationTransactionTemplate() {
return new NuanceSourceTransaction();
}
public function getCapabilities() { public function getCapabilities() {
return array( return array(
PhabricatorPolicyCapability::CAN_VIEW, PhabricatorPolicyCapability::CAN_VIEW,

View file

@ -72,7 +72,10 @@ final class PhortuneAccountViewController extends PhortuneController {
$payment_methods = $this->buildPaymentMethodsSection($account); $payment_methods = $this->buildPaymentMethodsSection($account);
$purchase_history = $this->buildPurchaseHistorySection($account); $purchase_history = $this->buildPurchaseHistorySection($account);
$charge_history = $this->buildChargeHistorySection($account); $charge_history = $this->buildChargeHistorySection($account);
$account_history = $this->buildAccountHistorySection($account); $timeline = $this->buildTransactionTimeline(
$account,
new PhortuneAccountTransactionQuery());
$timeline->setShouldTerminate(true);
$object_box = id(new PHUIObjectBoxView()) $object_box = id(new PHUIObjectBoxView())
->setHeader($header) ->setHeader($header)
@ -85,7 +88,7 @@ final class PhortuneAccountViewController extends PhortuneController {
$payment_methods, $payment_methods,
$purchase_history, $purchase_history,
$charge_history, $charge_history,
$account_history, $timeline,
), ),
array( array(
'title' => $title, 'title' => $title,
@ -258,23 +261,6 @@ final class PhortuneAccountViewController extends PhortuneController {
->appendChild($table); ->appendChild($table);
} }
private function buildAccountHistorySection(PhortuneAccount $account) {
$request = $this->getRequest();
$user = $request->getUser();
$xactions = id(new PhortuneAccountTransactionQuery())
->setViewer($user)
->withObjectPHIDs(array($account->getPHID()))
->execute();
$xaction_view = id(new PhabricatorApplicationTransactionView())
->setUser($user)
->setObjectPHID($account->getPHID())
->setTransactions($xactions);
return $xaction_view;
}
protected function buildApplicationCrumbs() { protected function buildApplicationCrumbs() {
$crumbs = parent::buildApplicationCrumbs(); $crumbs = parent::buildApplicationCrumbs();

View file

@ -161,15 +161,10 @@ final class PhortuneCartViewController
$crumbs->addTextCrumb(pht('Cart %d', $cart->getID())); $crumbs->addTextCrumb(pht('Cart %d', $cart->getID()));
$crumbs->setActionList($actions); $crumbs->setActionList($actions);
$xactions = id(new PhortuneCartTransactionQuery()) $timeline = $this->buildTransactionTimeline(
->setViewer($viewer) $cart,
->withObjectPHIDs(array($cart->getPHID())) new PhortuneCartTransactionQuery());
->execute(); $timeline
$xaction_view = id(new PhabricatorApplicationTransactionView())
->setUser($viewer)
->setObjectPHID($cart->getPHID())
->setTransactions($xactions)
->setShouldTerminate(true); ->setShouldTerminate(true);
return $this->buildApplicationPage( return $this->buildApplicationPage(
@ -177,7 +172,7 @@ final class PhortuneCartViewController
$crumbs, $crumbs,
$cart_box, $cart_box,
$charges, $charges,
$xaction_view, $timeline,
), ),
array( array(
'title' => pht('Cart'), 'title' => pht('Cart'),

View file

@ -12,7 +12,9 @@ final class PhortuneLandingController extends PhortuneController {
->execute(); ->execute();
if (!$accounts) { if (!$accounts) {
$account = $this->createUserAccount($user); $account = PhortuneAccount::createNewAccount(
$user,
PhabricatorContentSource::newFromRequest($request));
$accounts = array($account); $accounts = array($account);
} }

View file

@ -53,15 +53,10 @@ final class PhortuneMerchantViewController
->setHeader($header) ->setHeader($header)
->appendChild($properties); ->appendChild($properties);
$xactions = id(new PhortuneMerchantTransactionQuery()) $timeline = $this->buildTransactionTimeline(
->setViewer($viewer) $merchant,
->withObjectPHIDs(array($merchant->getPHID())) new PhortuneMerchantTransactionQuery());
->execute(); $timeline->setShouldTerminate(true);
$timeline = id(new PhabricatorApplicationTransactionView())
->setUser($viewer)
->setObjectPHID($merchant->getPHID())
->setTransactions($xactions);
return $this->buildApplicationPage( return $this->buildApplicationPage(
array( array(

View file

@ -7,7 +7,9 @@
* a personal account). * a personal account).
*/ */
final class PhortuneAccount extends PhortuneDAO final class PhortuneAccount extends PhortuneDAO
implements PhabricatorPolicyInterface { implements
PhabricatorApplicationTransactionInterface,
PhabricatorPolicyInterface {
protected $name; protected $name;
@ -95,6 +97,22 @@ final class PhortuneAccount extends PhortuneDAO
} }
/* -( PhabricatorApplicationTransactionInterface )------------------------- */
public function getApplicationTransactionEditor() {
return new PhortuneAccountEditor();
}
public function getApplicationTransactionObject() {
return $this;
}
public function getApplicationTransactionTemplate() {
return new PhortuneAccountTransaction();
}
/* -( PhabricatorPolicyInterface )----------------------------------------- */ /* -( PhabricatorPolicyInterface )----------------------------------------- */

View file

@ -1,7 +1,9 @@
<?php <?php
final class PhortuneCart extends PhortuneDAO final class PhortuneCart extends PhortuneDAO
implements PhabricatorPolicyInterface { implements
PhabricatorApplicationTransactionInterface,
PhabricatorPolicyInterface {
const STATUS_BUILDING = 'cart:building'; const STATUS_BUILDING = 'cart:building';
const STATUS_READY = 'cart:ready'; const STATUS_READY = 'cart:ready';
@ -597,6 +599,22 @@ final class PhortuneCart extends PhortuneDAO
} }
/* -( PhabricatorApplicationTransactionInterface )------------------------- */
public function getApplicationTransactionEditor() {
return new PhortuneCartEditor();
}
public function getApplicationTransactionObject() {
return $this;
}
public function getApplicationTransactionTemplate() {
return new PhortuneCartTransaction();
}
/* -( PhabricatorPolicyInterface )----------------------------------------- */ /* -( PhabricatorPolicyInterface )----------------------------------------- */

View file

@ -1,7 +1,9 @@
<?php <?php
final class PhortuneMerchant extends PhortuneDAO final class PhortuneMerchant extends PhortuneDAO
implements PhabricatorPolicyInterface { implements
PhabricatorApplicationTransactionInterface,
PhabricatorPolicyInterface {
protected $name; protected $name;
protected $viewPolicy; protected $viewPolicy;
@ -40,6 +42,22 @@ final class PhortuneMerchant extends PhortuneDAO
} }
/* -( PhabricatorApplicationTransactionInterface )------------------------- */
public function getApplicationTransactionEditor() {
return new PhortuneMerchantEditor();
}
public function getApplicationTransactionObject() {
return $this;
}
public function getApplicationTransactionTemplate() {
return new PhortuneMerchantTransaction();
}
/* -( PhabricatorPolicyInterface )----------------------------------------- */ /* -( PhabricatorPolicyInterface )----------------------------------------- */

View file

@ -29,7 +29,7 @@ final class PonderAnswerCommentController extends PonderController {
$qid = $answer->getQuestion()->getID(); $qid = $answer->getQuestion()->getID();
$aid = $answer->getID(); $aid = $answer->getID();
$view_uri = "Q{$qid}#A{$aid}"; $view_uri = "/Q{$qid}#A{$aid}";
$xactions = array(); $xactions = array();
$xactions[] = id(new PonderAnswerTransaction()) $xactions[] = id(new PonderAnswerTransaction())

View file

@ -20,27 +20,11 @@ final class PonderAnswerHistoryController extends PonderController {
return new Aphront404Response(); return new Aphront404Response();
} }
$xactions = id(new PonderAnswerTransactionQuery())
->setViewer($viewer)
->withObjectPHIDs(array($answer->getPHID()))
->execute();
$engine = id(new PhabricatorMarkupEngine()) $timeline = $this->buildTransactionTimeline(
->setViewer($viewer); $answer,
foreach ($xactions as $xaction) { new PonderAnswerTransactionQuery());
if ($xaction->getComment()) { $timeline->setShouldTerminate(true);
$engine->addObject(
$xaction->getComment(),
PhabricatorApplicationTransactionComment::MARKUP_FIELD_COMMENT);
}
}
$engine->process();
$timeline = id(new PhabricatorApplicationTransactionView())
->setUser($viewer)
->setObjectPHID($answer->getPHID())
->setTransactions($xactions)
->setMarkupEngine($engine);
$qid = $answer->getQuestion()->getID(); $qid = $answer->getQuestion()->getID();
$aid = $answer->getID(); $aid = $answer->getID();

View file

@ -20,27 +20,10 @@ final class PonderQuestionHistoryController extends PonderController {
return new Aphront404Response(); return new Aphront404Response();
} }
$xactions = id(new PonderQuestionTransactionQuery()) $timeline = $this->buildTransactionTimeline(
->setViewer($viewer) $question,
->withObjectPHIDs(array($question->getPHID())) new PonderQuestionTransactionQuery());
->execute(); $timeline->setShouldTerminate(true);
$engine = id(new PhabricatorMarkupEngine())
->setViewer($viewer);
foreach ($xactions as $xaction) {
if ($xaction->getComment()) {
$engine->addObject(
$xaction->getComment(),
PhabricatorApplicationTransactionComment::MARKUP_FIELD_COMMENT);
}
}
$engine->process();
$timeline = id(new PhabricatorApplicationTransactionView())
->setUser($viewer)
->setObjectPHID($question->getPHID())
->setTransactions($xactions)
->setMarkupEngine($engine);
$qid = $question->getID(); $qid = $question->getID();

View file

@ -178,31 +178,14 @@ final class PonderQuestionViewController extends PonderController {
} }
private function buildQuestionTransactions(PonderQuestion $question) { private function buildQuestionTransactions(PonderQuestion $question) {
$viewer = $this->getRequest()->getUser(); $viewer = $this->getViewer();
$id = $question->getID(); $id = $question->getID();
$xactions = id(new PonderQuestionTransactionQuery()) $timeline = $this->buildTransactionTimeline(
->setViewer($viewer) $question,
->withTransactionTypes(array(PhabricatorTransactions::TYPE_COMMENT)) id(new PonderQuestionTransactionQuery())
->withObjectPHIDs(array($question->getPHID())) ->withTransactionTypes(array(PhabricatorTransactions::TYPE_COMMENT)));
->execute(); $xactions = $timeline->getTransactions();
$engine = id(new PhabricatorMarkupEngine())
->setViewer($viewer);
foreach ($xactions as $xaction) {
if ($xaction->getComment()) {
$engine->addObject(
$xaction->getComment(),
PhabricatorApplicationTransactionComment::MARKUP_FIELD_COMMENT);
}
}
$engine->process();
$timeline = id(new PhabricatorApplicationTransactionView())
->setUser($viewer)
->setObjectPHID($question->getPHID())
->setTransactions($xactions)
->setMarkupEngine($engine);
$add_comment = id(new PhabricatorApplicationTransactionCommentView()) $add_comment = id(new PhabricatorApplicationTransactionCommentView())
->setUser($viewer) ->setUser($viewer)
@ -220,6 +203,13 @@ final class PonderQuestionViewController extends PonderController {
)); ));
} }
/**
* This is fairly non-standard; building N timelines at once (N = number of
* answers) is tricky business.
*
* TODO - re-factor this to ajax in one answer panel at a time in a more
* standard fashion. This is necessary to scale this application.
*/
private function buildAnswers(array $answers) { private function buildAnswers(array $answers) {
$request = $this->getRequest(); $request = $this->getRequest();
$viewer = $request->getUser(); $viewer = $request->getUser();

View file

@ -2,6 +2,7 @@
final class PonderAnswer extends PonderDAO final class PonderAnswer extends PonderDAO
implements implements
PhabricatorApplicationTransactionInterface,
PhabricatorMarkupInterface, PhabricatorMarkupInterface,
PonderVotableInterface, PonderVotableInterface,
PhabricatorPolicyInterface, PhabricatorPolicyInterface,
@ -112,6 +113,23 @@ final class PonderAnswer extends PonderDAO
return self::MARKUP_FIELD_CONTENT; return self::MARKUP_FIELD_CONTENT;
} }
/* -( PhabricatorApplicationTransactionInterface )------------------------- */
public function getApplicationTransactionEditor() {
return new PonderAnswerEditor();
}
public function getApplicationTransactionObject() {
return $this;
}
public function getApplicationTransactionTemplate() {
return new PonderAnswerTransaction();
}
// Markup interface // Markup interface
public function getMarkupFieldKey($field) { public function getMarkupFieldKey($field) {

View file

@ -2,6 +2,7 @@
final class PonderQuestion extends PonderDAO final class PonderQuestion extends PonderDAO
implements implements
PhabricatorApplicationTransactionInterface,
PhabricatorMarkupInterface, PhabricatorMarkupInterface,
PonderVotableInterface, PonderVotableInterface,
PhabricatorSubscribableInterface, PhabricatorSubscribableInterface,
@ -144,6 +145,23 @@ final class PonderQuestion extends PonderDAO
return self::MARKUP_FIELD_CONTENT; return self::MARKUP_FIELD_CONTENT;
} }
/* -( PhabricatorApplicationTransactionInterface )------------------------- */
public function getApplicationTransactionEditor() {
return new PonderQuestionEditor();
}
public function getApplicationTransactionObject() {
return $this;
}
public function getApplicationTransactionTemplate() {
return new PonderQuestionTransaction();
}
// Markup interface // Markup interface
public function getMarkupFieldKey($field) { public function getMarkupFieldKey($field) {

View file

@ -25,15 +25,10 @@ final class ReleephBranchHistoryController extends ReleephBranchController {
} }
$this->setBranch($branch); $this->setBranch($branch);
$xactions = id(new ReleephBranchTransactionQuery()) $timeline = $this->buildTransactionTimeline(
->setViewer($viewer) $branch,
->withObjectPHIDs(array($branch->getPHID())) new ReleephBranchTransactionQuery());
->execute(); $timeline
$timeline = id(new PhabricatorApplicationTransactionView())
->setUser($viewer)
->setObjectPHID($branch->getPHID())
->setTransactions($xactions)
->setShouldTerminate(true); ->setShouldTerminate(true);
$crumbs = $this->buildApplicationCrumbs(); $crumbs = $this->buildApplicationCrumbs();

View file

@ -85,6 +85,7 @@ final class ReleephProductEditController extends ReleephProductController {
} }
$product $product
->setName($product_name)
->setTrunkBranch($trunk_branch) ->setTrunkBranch($trunk_branch)
->setDetail('pushers', $pusher_phids) ->setDetail('pushers', $pusher_phids)
->setDetail('pick_failure_instructions', $pick_failure_instructions) ->setDetail('pick_failure_instructions', $pick_failure_instructions)

View file

@ -25,16 +25,10 @@ final class ReleephProductHistoryController extends ReleephProductController {
} }
$this->setProduct($product); $this->setProduct($product);
$xactions = id(new ReleephProductTransactionQuery()) $timeline = $this->buildTransactionTimeline(
->setViewer($viewer) $product,
->withObjectPHIDs(array($product->getPHID())) new ReleephProductTransactionQuery());
->execute(); $timeline->setShouldTerminate(true);
$timeline = id(new PhabricatorApplicationTransactionView())
->setUser($viewer)
->setObjectPHID($product->getPHID())
->setTransactions($xactions)
->setShouldTerminate(true);
$crumbs = $this->buildApplicationCrumbs(); $crumbs = $this->buildApplicationCrumbs();
$crumbs->addTextCrumb(pht('History')); $crumbs->addTextCrumb(pht('History'));

View file

@ -56,15 +56,9 @@ final class ReleephRequestViewController
->setCustomFields($field_list) ->setCustomFields($field_list)
->setPullRequest($pull); ->setPullRequest($pull);
$xactions = id(new ReleephRequestTransactionQuery()) $timeline = $this->buildTransactionTimeline(
->setViewer($viewer) $pull,
->withObjectPHIDs(array($pull->getPHID())) new ReleephRequestTransactionQuery());
->execute();
$timeline = id(new PhabricatorApplicationTransactionView())
->setUser($request->getUser())
->setObjectPHID($pull->getPHID())
->setTransactions($xactions);
$add_comment_header = pht('Plea or Yield'); $add_comment_header = pht('Plea or Yield');

View file

@ -1,7 +1,9 @@
<?php <?php
final class ReleephBranch extends ReleephDAO final class ReleephBranch extends ReleephDAO
implements PhabricatorPolicyInterface { implements
PhabricatorApplicationTransactionInterface,
PhabricatorPolicyInterface {
protected $releephProjectID; protected $releephProjectID;
protected $isActive; protected $isActive;
@ -149,6 +151,22 @@ final class ReleephBranch extends ReleephDAO
} }
/* -( PhabricatorApplicationTransactionInterface )------------------------- */
public function getApplicationTransactionEditor() {
return new ReleephBranchEditor();
}
public function getApplicationTransactionObject() {
return $this;
}
public function getApplicationTransactionTemplate() {
return new ReleephBranchTransaction();
}
/* -( PhabricatorPolicyInterface )----------------------------------------- */ /* -( PhabricatorPolicyInterface )----------------------------------------- */

View file

@ -1,7 +1,9 @@
<?php <?php
final class ReleephProject extends ReleephDAO final class ReleephProject extends ReleephDAO
implements PhabricatorPolicyInterface { implements
PhabricatorApplicationTransactionInterface,
PhabricatorPolicyInterface {
const DEFAULT_BRANCH_NAMESPACE = 'releeph-releases'; const DEFAULT_BRANCH_NAMESPACE = 'releeph-releases';
const SYSTEM_AGENT_USERNAME_PREFIX = 'releeph-agent-'; const SYSTEM_AGENT_USERNAME_PREFIX = 'releeph-agent-';
@ -121,8 +123,26 @@ final class ReleephProject extends ReleephDAO
return false; return false;
} }
/* -( PhabricatorApplicationTransactionInterface )------------------------- */
public function getApplicationTransactionEditor() {
return new ReleephProductEditor();
}
public function getApplicationTransactionObject() {
return $this;
}
public function getApplicationTransactionTemplate() {
return new ReleephProductTransaction();
}
/* -( PhabricatorPolicyInterface )----------------------------------------- */ /* -( PhabricatorPolicyInterface )----------------------------------------- */
public function getCapabilities() { public function getCapabilities() {
return array( return array(
PhabricatorPolicyCapability::CAN_VIEW, PhabricatorPolicyCapability::CAN_VIEW,

View file

@ -2,6 +2,7 @@
final class ReleephRequest extends ReleephDAO final class ReleephRequest extends ReleephDAO
implements implements
PhabricatorApplicationTransactionInterface,
PhabricatorPolicyInterface, PhabricatorPolicyInterface,
PhabricatorCustomFieldInterface { PhabricatorCustomFieldInterface {
@ -296,6 +297,22 @@ final class ReleephRequest extends ReleephDAO
} }
/* -( PhabricatorApplicationTransactionInterface )------------------------- */
public function getApplicationTransactionEditor() {
return new ReleephRequestTransactionalEditor();
}
public function getApplicationTransactionObject() {
return $this;
}
public function getApplicationTransactionTemplate() {
return new ReleephRequestTransaction();
}
/* -( PhabricatorPolicyInterface )----------------------------------------- */ /* -( PhabricatorPolicyInterface )----------------------------------------- */

View file

@ -6,6 +6,7 @@
*/ */
final class PhabricatorRepository extends PhabricatorRepositoryDAO final class PhabricatorRepository extends PhabricatorRepositoryDAO
implements implements
PhabricatorApplicationTransactionInterface,
PhabricatorPolicyInterface, PhabricatorPolicyInterface,
PhabricatorFlaggableInterface, PhabricatorFlaggableInterface,
PhabricatorMarkupInterface, PhabricatorMarkupInterface,
@ -1512,6 +1513,22 @@ final class PhabricatorRepository extends PhabricatorRepositoryDAO
} }
/* -( PhabricatorApplicationTransactionInterface )------------------------- */
public function getApplicationTransactionEditor() {
return new PhabricatorRepositoryEditor();
}
public function getApplicationTransactionObject() {
return $this;
}
public function getApplicationTransactionTemplate() {
return new PhabricatorRepositoryTransaction();
}
/* -( PhabricatorPolicyInterface )----------------------------------------- */ /* -( PhabricatorPolicyInterface )----------------------------------------- */