1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-01-31 08:58:20 +01:00

Transactions - deploy buildTransactionTimeline against Config, Pholio, and Projects

Summary: Ref T4712. These are a bit time consuming to test so might as well send off a batch now and again.

Test Plan: foreach impacted controller, made sure the timeline rendered as it did before. for project column and config, noted the "should terminate" UI was also rendered unlike before.

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin, epriestley

Maniphest Tasks: T4712

Differential Revision: https://secure.phabricator.com/D10923
This commit is contained in:
Bob Trahan 2014-12-03 12:28:53 -08:00
parent 798be00fc3
commit c2522a89b9
8 changed files with 78 additions and 55 deletions

View file

@ -4551,6 +4551,7 @@ phutil_register_library_map(array(
'PhabricatorConfigEditor' => 'PhabricatorApplicationTransactionEditor', 'PhabricatorConfigEditor' => 'PhabricatorApplicationTransactionEditor',
'PhabricatorConfigEntry' => array( 'PhabricatorConfigEntry' => array(
'PhabricatorConfigEntryDAO', 'PhabricatorConfigEntryDAO',
'PhabricatorApplicationTransactionInterface',
'PhabricatorPolicyInterface', 'PhabricatorPolicyInterface',
), ),
'PhabricatorConfigEntryDAO' => 'PhabricatorLiskDAO', 'PhabricatorConfigEntryDAO' => 'PhabricatorLiskDAO',
@ -5212,6 +5213,7 @@ phutil_register_library_map(array(
'PhabricatorPonderApplication' => 'PhabricatorApplication', 'PhabricatorPonderApplication' => 'PhabricatorApplication',
'PhabricatorProject' => array( 'PhabricatorProject' => array(
'PhabricatorProjectDAO', 'PhabricatorProjectDAO',
'PhabricatorApplicationTransactionInterface',
'PhabricatorFlaggableInterface', 'PhabricatorFlaggableInterface',
'PhabricatorPolicyInterface', 'PhabricatorPolicyInterface',
'PhabricatorSubscribableInterface', 'PhabricatorSubscribableInterface',
@ -5226,6 +5228,7 @@ phutil_register_library_map(array(
'PhabricatorProjectBoardViewController' => 'PhabricatorProjectBoardController', 'PhabricatorProjectBoardViewController' => 'PhabricatorProjectBoardController',
'PhabricatorProjectColumn' => array( 'PhabricatorProjectColumn' => array(
'PhabricatorProjectDAO', 'PhabricatorProjectDAO',
'PhabricatorApplicationTransactionInterface',
'PhabricatorPolicyInterface', 'PhabricatorPolicyInterface',
'PhabricatorDestructibleInterface', 'PhabricatorDestructibleInterface',
), ),

View file

@ -214,21 +214,16 @@ final class PhabricatorConfigEditController
$crumbs->addTextCrumb($this->key, '/config/edit/'.$this->key); $crumbs->addTextCrumb($this->key, '/config/edit/'.$this->key);
$xactions = id(new PhabricatorConfigTransactionQuery()) $timeline = $this->buildTransactionTimeline(
->withObjectPHIDs(array($config_entry->getPHID())) $config_entry,
->setViewer($user) new PhabricatorConfigTransactionQuery());
->execute(); $timeline->setShouldTerminate(true);
$xaction_view = id(new PhabricatorApplicationTransactionView())
->setUser($user)
->setObjectPHID($config_entry->getPHID())
->setTransactions($xactions);
return $this->buildApplicationPage( return $this->buildApplicationPage(
array( array(
$crumbs, $crumbs,
$form_box, $form_box,
$xaction_view, $timeline,
), ),
array( array(
'title' => $title, 'title' => $title,

View file

@ -1,7 +1,10 @@
<?php <?php
final class PhabricatorConfigEntry extends PhabricatorConfigEntryDAO final class PhabricatorConfigEntry
implements PhabricatorPolicyInterface { extends PhabricatorConfigEntryDAO
implements
PhabricatorApplicationTransactionInterface,
PhabricatorPolicyInterface {
protected $namespace; protected $namespace;
protected $configKey; protected $configKey;
@ -50,6 +53,22 @@ final class PhabricatorConfigEntry extends PhabricatorConfigEntryDAO
} }
/* -( PhabricatorApplicationTransactionInterface )------------------------- */
public function getApplicationTransactionEditor() {
return new PhabricatorConfigEditor();
}
public function getApplicationTransactionObject() {
return $this;
}
public function getApplicationTransactionTemplate() {
return new PhabricatorConfigTransaction();
}
/* -( PhabricatorPolicyInterface )----------------------------------------- */ /* -( PhabricatorPolicyInterface )----------------------------------------- */

View file

@ -38,11 +38,6 @@ final class PholioMockViewController extends PholioController {
return new Aphront404Response(); return new Aphront404Response();
} }
$xactions = id(new PholioTransactionQuery())
->setViewer($user)
->withObjectPHIDs(array($mock->getPHID()))
->execute();
$phids = PhabricatorEdgeQuery::loadDestinationPHIDs( $phids = PhabricatorEdgeQuery::loadDestinationPHIDs(
$mock->getPHID(), $mock->getPHID(),
PhabricatorEdgeConfig::TYPE_MOCK_HAS_TASK); PhabricatorEdgeConfig::TYPE_MOCK_HAS_TASK);
@ -53,14 +48,6 @@ final class PholioMockViewController extends PholioController {
$engine = id(new PhabricatorMarkupEngine()) $engine = id(new PhabricatorMarkupEngine())
->setViewer($user); ->setViewer($user);
$engine->addObject($mock, PholioMock::MARKUP_FIELD_DESCRIPTION); $engine->addObject($mock, PholioMock::MARKUP_FIELD_DESCRIPTION);
foreach ($xactions as $xaction) {
if ($xaction->getComment()) {
$engine->addObject(
$xaction->getComment(),
PhabricatorApplicationTransactionComment::MARKUP_FIELD_COMMENT);
}
}
$engine->process();
$title = $mock->getName(); $title = $mock->getName();
@ -80,6 +67,12 @@ final class PholioMockViewController extends PholioController {
->setStatus($header_icon, $header_color, $header_name) ->setStatus($header_icon, $header_color, $header_name)
->setPolicyObject($mock); ->setPolicyObject($mock);
$timeline = $this->buildTransactionTimeline(
$mock,
new PholioTransactionQuery(),
$engine);
$timeline->setMock($mock);
$actions = $this->buildActionView($mock); $actions = $this->buildActionView($mock);
$properties = $this->buildPropertyView($mock, $engine, $actions); $properties = $this->buildPropertyView($mock, $engine, $actions);
@ -98,13 +91,6 @@ final class PholioMockViewController extends PholioController {
->setHeaderText(pht('Image')) ->setHeaderText(pht('Image'))
->appendChild($output); ->appendChild($output);
$xaction_view = id(new PholioTransactionView())
->setUser($this->getRequest()->getUser())
->setMock($mock)
->setObjectPHID($mock->getPHID())
->setTransactions($xactions)
->setMarkupEngine($engine);
$add_comment = $this->buildAddCommentView($mock, $comment_form_id); $add_comment = $this->buildAddCommentView($mock, $comment_form_id);
$crumbs = $this->buildApplicationCrumbs(); $crumbs = $this->buildApplicationCrumbs();
@ -124,7 +110,7 @@ final class PholioMockViewController extends PholioController {
$object_box, $object_box,
$output, $output,
$thumb_grid, $thumb_grid,
$xaction_view, $timeline,
$add_comment, $add_comment,
); );

View file

@ -41,18 +41,10 @@ final class PhabricatorProjectColumnDetailController
return new Aphront404Response(); return new Aphront404Response();
} }
$xactions = id(new PhabricatorProjectColumnTransactionQuery()) $timeline = $this->buildTransactionTimeline(
->setViewer($viewer) $column,
->withObjectPHIDs(array($column->getPHID())) new PhabricatorProjectColumnTransactionQuery());
->execute(); $timeline->setShouldTerminate(true);
$engine = id(new PhabricatorMarkupEngine())
->setViewer($viewer);
$timeline = id(new PhabricatorApplicationTransactionView())
->setUser($viewer)
->setObjectPHID($column->getPHID())
->setTransactions($xactions);
$title = pht('%s', $column->getDisplayName()); $title = pht('%s', $column->getDisplayName());
$crumbs = $this->buildApplicationCrumbs(); $crumbs = $this->buildApplicationCrumbs();

View file

@ -48,16 +48,10 @@ final class PhabricatorProjectEditMainController
->setHeader($header) ->setHeader($header)
->addPropertyList($properties); ->addPropertyList($properties);
$xactions = id(new PhabricatorProjectTransactionQuery()) $timeline = $this->buildTransactionTimeline(
->setViewer($viewer) $project,
->withObjectPHIDs(array($project->getPHID())) new PhabricatorProjectTransactionQuery());
->execute(); $timeline->setShouldTerminate(true);
$timeline = id(new PhabricatorApplicationTransactionView())
->setUser($viewer)
->setObjectPHID($project->getPHID())
->setShouldTerminate(true)
->setTransactions($xactions);
return $this->buildApplicationPage( return $this->buildApplicationPage(
array( array(

View file

@ -2,6 +2,7 @@
final class PhabricatorProject extends PhabricatorProjectDAO final class PhabricatorProject extends PhabricatorProjectDAO
implements implements
PhabricatorApplicationTransactionInterface,
PhabricatorFlaggableInterface, PhabricatorFlaggableInterface,
PhabricatorPolicyInterface, PhabricatorPolicyInterface,
PhabricatorSubscribableInterface, PhabricatorSubscribableInterface,
@ -359,6 +360,22 @@ final class PhabricatorProject extends PhabricatorProjectDAO
} }
/* -( PhabricatorApplicationTransactionInterface )------------------------- */
public function getApplicationTransactionEditor() {
return new PhabricatorProjectTransactionEditor();
}
public function getApplicationTransactionObject() {
return $this;
}
public function getApplicationTransactionTemplate() {
return new PhabricatorProjectTransaction();
}
/* -( PhabricatorDestructibleInterface )----------------------------------- */ /* -( PhabricatorDestructibleInterface )----------------------------------- */
public function destroyObjectPermanently( public function destroyObjectPermanently(

View file

@ -3,6 +3,7 @@
final class PhabricatorProjectColumn final class PhabricatorProjectColumn
extends PhabricatorProjectDAO extends PhabricatorProjectDAO
implements implements
PhabricatorApplicationTransactionInterface,
PhabricatorPolicyInterface, PhabricatorPolicyInterface,
PhabricatorDestructibleInterface { PhabricatorDestructibleInterface {
@ -135,6 +136,22 @@ final class PhabricatorProjectColumn
} }
/* -( PhabricatorApplicationTransactionInterface )------------------------- */
public function getApplicationTransactionEditor() {
return new PhabricatorProjectColumnTransactionEditor();
}
public function getApplicationTransactionObject() {
return $this;
}
public function getApplicationTransactionTemplate() {
return new PhabricatorProjectColumnTransaction();
}
/* -( PhabricatorPolicyInterface )----------------------------------------- */ /* -( PhabricatorPolicyInterface )----------------------------------------- */