1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-21 04:50:55 +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',
'HarbormasterBuild' => array(
'HarbormasterDAO',
'PhabricatorApplicationTransactionInterface',
'PhabricatorPolicyInterface',
),
'HarbormasterBuildAbortedException' => 'Exception',
@ -3820,6 +3821,7 @@ phutil_register_library_map(array(
'HarbormasterBuildPHIDType' => 'PhabricatorPHIDType',
'HarbormasterBuildPlan' => array(
'HarbormasterDAO',
'PhabricatorApplicationTransactionInterface',
'PhabricatorPolicyInterface',
'PhabricatorSubscribableInterface',
),
@ -3833,6 +3835,7 @@ phutil_register_library_map(array(
'HarbormasterBuildQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
'HarbormasterBuildStep' => array(
'HarbormasterDAO',
'PhabricatorApplicationTransactionInterface',
'PhabricatorPolicyInterface',
'PhabricatorCustomFieldInterface',
),
@ -3859,6 +3862,7 @@ phutil_register_library_map(array(
'HarbormasterBuildWorker' => 'HarbormasterWorker',
'HarbormasterBuildable' => array(
'HarbormasterDAO',
'PhabricatorApplicationTransactionInterface',
'PhabricatorPolicyInterface',
'HarbormasterBuildableInterface',
),
@ -4154,6 +4158,7 @@ phutil_register_library_map(array(
'NuanceSchemaSpec' => 'PhabricatorConfigSchemaSpec',
'NuanceSource' => array(
'NuanceDAO',
'PhabricatorApplicationTransactionInterface',
'PhabricatorPolicyInterface',
),
'NuanceSourceDefaultEditCapability' => 'PhabricatorPolicyCapability',
@ -5312,6 +5317,7 @@ phutil_register_library_map(array(
'PhabricatorRepositoriesApplication' => 'PhabricatorApplication',
'PhabricatorRepository' => array(
'PhabricatorRepositoryDAO',
'PhabricatorApplicationTransactionInterface',
'PhabricatorPolicyInterface',
'PhabricatorFlaggableInterface',
'PhabricatorMarkupInterface',
@ -5837,6 +5843,7 @@ phutil_register_library_map(array(
'PholioUploadedImageView' => 'AphrontView',
'PhortuneAccount' => array(
'PhortuneDAO',
'PhabricatorApplicationTransactionInterface',
'PhabricatorPolicyInterface',
),
'PhortuneAccountEditController' => 'PhortuneController',
@ -5851,6 +5858,7 @@ phutil_register_library_map(array(
'PhortuneBalancedPaymentProvider' => 'PhortunePaymentProvider',
'PhortuneCart' => array(
'PhortuneDAO',
'PhabricatorApplicationTransactionInterface',
'PhabricatorPolicyInterface',
),
'PhortuneCartAcceptController' => 'PhortuneCartController',
@ -5887,6 +5895,7 @@ phutil_register_library_map(array(
'PhortuneMemberHasMerchantEdgeType' => 'PhabricatorEdgeType',
'PhortuneMerchant' => array(
'PhortuneDAO',
'PhabricatorApplicationTransactionInterface',
'PhabricatorPolicyInterface',
),
'PhortuneMerchantCapability' => 'PhabricatorPolicyCapability',
@ -6056,6 +6065,7 @@ phutil_register_library_map(array(
'PonderAddAnswerView' => 'AphrontView',
'PonderAnswer' => array(
'PonderDAO',
'PhabricatorApplicationTransactionInterface',
'PhabricatorMarkupInterface',
'PonderVotableInterface',
'PhabricatorPolicyInterface',
@ -6079,6 +6089,7 @@ phutil_register_library_map(array(
'PonderEditor' => 'PhabricatorApplicationTransactionEditor',
'PonderQuestion' => array(
'PonderDAO',
'PhabricatorApplicationTransactionInterface',
'PhabricatorMarkupInterface',
'PonderVotableInterface',
'PhabricatorSubscribableInterface',
@ -6126,6 +6137,7 @@ phutil_register_library_map(array(
'ReleephAuthorFieldSpecification' => 'ReleephFieldSpecification',
'ReleephBranch' => array(
'ReleephDAO',
'PhabricatorApplicationTransactionInterface',
'PhabricatorPolicyInterface',
),
'ReleephBranchAccessController' => 'ReleephBranchController',
@ -6183,6 +6195,7 @@ phutil_register_library_map(array(
),
'ReleephProject' => array(
'ReleephDAO',
'PhabricatorApplicationTransactionInterface',
'PhabricatorPolicyInterface',
),
'ReleephProjectInfoConduitAPIMethod' => 'ReleephConduitAPIMethod',
@ -6192,6 +6205,7 @@ phutil_register_library_map(array(
'ReleephReasonFieldSpecification' => 'ReleephFieldSpecification',
'ReleephRequest' => array(
'ReleephDAO',
'PhabricatorApplicationTransactionInterface',
'PhabricatorPolicyInterface',
'PhabricatorCustomFieldInterface',
),

View file

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

View file

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

View file

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

View file

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

View file

@ -93,27 +93,10 @@ final class DiffusionRepositoryEditMainController
$repository,
$this->buildActionsActions($repository));
$xactions = id(new PhabricatorRepositoryTransactionQuery())
->setViewer($viewer)
->withObjectPHIDs(array($repository->getPHID()))
->execute();
$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);
$timeline = $this->buildTransactionTimeline(
$repository,
new PhabricatorRepositoryTransactionQuery());
$timeline->setShouldTerminate(true);
$boxes = array();
@ -187,7 +170,7 @@ final class DiffusionRepositoryEditMainController
array(
$crumbs,
$boxes,
$xaction_view,
$timeline,
),
array(
'title' => $title,

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -2,6 +2,7 @@
final class HarbormasterBuildable extends HarbormasterDAO
implements
PhabricatorApplicationTransactionInterface,
PhabricatorPolicyInterface,
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 )----------------------------------------- */

View file

@ -1,7 +1,9 @@
<?php
final class HarbormasterBuild extends HarbormasterDAO
implements PhabricatorPolicyInterface {
implements
PhabricatorApplicationTransactionInterface,
PhabricatorPolicyInterface {
protected $buildablePHID;
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 )----------------------------------------- */

View file

@ -2,6 +2,7 @@
final class HarbormasterBuildPlan extends HarbormasterDAO
implements
PhabricatorApplicationTransactionInterface,
PhabricatorPolicyInterface,
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 )----------------------------------------- */

View file

@ -2,6 +2,7 @@
final class HarbormasterBuildStep extends HarbormasterDAO
implements
PhabricatorApplicationTransactionInterface,
PhabricatorPolicyInterface,
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 )----------------------------------------- */

View file

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

View file

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

View file

@ -1,7 +1,9 @@
<?php
final class NuanceSource extends NuanceDAO
implements PhabricatorPolicyInterface {
implements
PhabricatorApplicationTransactionInterface,
PhabricatorPolicyInterface {
protected $name;
protected $type;
@ -64,6 +66,23 @@ final class NuanceSource extends NuanceDAO
->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() {
return array(
PhabricatorPolicyCapability::CAN_VIEW,

View file

@ -72,7 +72,10 @@ final class PhortuneAccountViewController extends PhortuneController {
$payment_methods = $this->buildPaymentMethodsSection($account);
$purchase_history = $this->buildPurchaseHistorySection($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())
->setHeader($header)
@ -85,7 +88,7 @@ final class PhortuneAccountViewController extends PhortuneController {
$payment_methods,
$purchase_history,
$charge_history,
$account_history,
$timeline,
),
array(
'title' => $title,
@ -258,23 +261,6 @@ final class PhortuneAccountViewController extends PhortuneController {
->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() {
$crumbs = parent::buildApplicationCrumbs();

View file

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

View file

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

View file

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

View file

@ -7,7 +7,9 @@
* a personal account).
*/
final class PhortuneAccount extends PhortuneDAO
implements PhabricatorPolicyInterface {
implements
PhabricatorApplicationTransactionInterface,
PhabricatorPolicyInterface {
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 )----------------------------------------- */

View file

@ -1,7 +1,9 @@
<?php
final class PhortuneCart extends PhortuneDAO
implements PhabricatorPolicyInterface {
implements
PhabricatorApplicationTransactionInterface,
PhabricatorPolicyInterface {
const STATUS_BUILDING = 'cart:building';
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 )----------------------------------------- */

View file

@ -1,7 +1,9 @@
<?php
final class PhortuneMerchant extends PhortuneDAO
implements PhabricatorPolicyInterface {
implements
PhabricatorApplicationTransactionInterface,
PhabricatorPolicyInterface {
protected $name;
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 )----------------------------------------- */

View file

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

View file

@ -20,27 +20,11 @@ final class PonderAnswerHistoryController extends PonderController {
return new Aphront404Response();
}
$xactions = id(new PonderAnswerTransactionQuery())
->setViewer($viewer)
->withObjectPHIDs(array($answer->getPHID()))
->execute();
$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($answer->getPHID())
->setTransactions($xactions)
->setMarkupEngine($engine);
$timeline = $this->buildTransactionTimeline(
$answer,
new PonderAnswerTransactionQuery());
$timeline->setShouldTerminate(true);
$qid = $answer->getQuestion()->getID();
$aid = $answer->getID();

View file

@ -20,27 +20,10 @@ final class PonderQuestionHistoryController extends PonderController {
return new Aphront404Response();
}
$xactions = id(new PonderQuestionTransactionQuery())
->setViewer($viewer)
->withObjectPHIDs(array($question->getPHID()))
->execute();
$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);
$timeline = $this->buildTransactionTimeline(
$question,
new PonderQuestionTransactionQuery());
$timeline->setShouldTerminate(true);
$qid = $question->getID();

View file

@ -178,31 +178,14 @@ final class PonderQuestionViewController extends PonderController {
}
private function buildQuestionTransactions(PonderQuestion $question) {
$viewer = $this->getRequest()->getUser();
$viewer = $this->getViewer();
$id = $question->getID();
$xactions = id(new PonderQuestionTransactionQuery())
->setViewer($viewer)
->withTransactionTypes(array(PhabricatorTransactions::TYPE_COMMENT))
->withObjectPHIDs(array($question->getPHID()))
->execute();
$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);
$timeline = $this->buildTransactionTimeline(
$question,
id(new PonderQuestionTransactionQuery())
->withTransactionTypes(array(PhabricatorTransactions::TYPE_COMMENT)));
$xactions = $timeline->getTransactions();
$add_comment = id(new PhabricatorApplicationTransactionCommentView())
->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) {
$request = $this->getRequest();
$viewer = $request->getUser();

View file

@ -2,6 +2,7 @@
final class PonderAnswer extends PonderDAO
implements
PhabricatorApplicationTransactionInterface,
PhabricatorMarkupInterface,
PonderVotableInterface,
PhabricatorPolicyInterface,
@ -112,6 +113,23 @@ final class PonderAnswer extends PonderDAO
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
public function getMarkupFieldKey($field) {

View file

@ -2,6 +2,7 @@
final class PonderQuestion extends PonderDAO
implements
PhabricatorApplicationTransactionInterface,
PhabricatorMarkupInterface,
PonderVotableInterface,
PhabricatorSubscribableInterface,
@ -144,6 +145,23 @@ final class PonderQuestion extends PonderDAO
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
public function getMarkupFieldKey($field) {

View file

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

View file

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

View file

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

View file

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

View file

@ -1,7 +1,9 @@
<?php
final class ReleephBranch extends ReleephDAO
implements PhabricatorPolicyInterface {
implements
PhabricatorApplicationTransactionInterface,
PhabricatorPolicyInterface {
protected $releephProjectID;
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 )----------------------------------------- */

View file

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

View file

@ -2,6 +2,7 @@
final class ReleephRequest extends ReleephDAO
implements
PhabricatorApplicationTransactionInterface,
PhabricatorPolicyInterface,
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 )----------------------------------------- */

View file

@ -6,6 +6,7 @@
*/
final class PhabricatorRepository extends PhabricatorRepositoryDAO
implements
PhabricatorApplicationTransactionInterface,
PhabricatorPolicyInterface,
PhabricatorFlaggableInterface,
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 )----------------------------------------- */