1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-01-19 03:01:11 +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',
'PhabricatorConfigEntry' => array(
'PhabricatorConfigEntryDAO',
'PhabricatorApplicationTransactionInterface',
'PhabricatorPolicyInterface',
),
'PhabricatorConfigEntryDAO' => 'PhabricatorLiskDAO',
@ -5212,6 +5213,7 @@ phutil_register_library_map(array(
'PhabricatorPonderApplication' => 'PhabricatorApplication',
'PhabricatorProject' => array(
'PhabricatorProjectDAO',
'PhabricatorApplicationTransactionInterface',
'PhabricatorFlaggableInterface',
'PhabricatorPolicyInterface',
'PhabricatorSubscribableInterface',
@ -5226,6 +5228,7 @@ phutil_register_library_map(array(
'PhabricatorProjectBoardViewController' => 'PhabricatorProjectBoardController',
'PhabricatorProjectColumn' => array(
'PhabricatorProjectDAO',
'PhabricatorApplicationTransactionInterface',
'PhabricatorPolicyInterface',
'PhabricatorDestructibleInterface',
),

View file

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

View file

@ -1,7 +1,10 @@
<?php
final class PhabricatorConfigEntry extends PhabricatorConfigEntryDAO
implements PhabricatorPolicyInterface {
final class PhabricatorConfigEntry
extends PhabricatorConfigEntryDAO
implements
PhabricatorApplicationTransactionInterface,
PhabricatorPolicyInterface {
protected $namespace;
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 )----------------------------------------- */

View file

@ -38,11 +38,6 @@ final class PholioMockViewController extends PholioController {
return new Aphront404Response();
}
$xactions = id(new PholioTransactionQuery())
->setViewer($user)
->withObjectPHIDs(array($mock->getPHID()))
->execute();
$phids = PhabricatorEdgeQuery::loadDestinationPHIDs(
$mock->getPHID(),
PhabricatorEdgeConfig::TYPE_MOCK_HAS_TASK);
@ -53,14 +48,6 @@ final class PholioMockViewController extends PholioController {
$engine = id(new PhabricatorMarkupEngine())
->setViewer($user);
$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();
@ -80,6 +67,12 @@ final class PholioMockViewController extends PholioController {
->setStatus($header_icon, $header_color, $header_name)
->setPolicyObject($mock);
$timeline = $this->buildTransactionTimeline(
$mock,
new PholioTransactionQuery(),
$engine);
$timeline->setMock($mock);
$actions = $this->buildActionView($mock);
$properties = $this->buildPropertyView($mock, $engine, $actions);
@ -98,13 +91,6 @@ final class PholioMockViewController extends PholioController {
->setHeaderText(pht('Image'))
->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);
$crumbs = $this->buildApplicationCrumbs();
@ -124,7 +110,7 @@ final class PholioMockViewController extends PholioController {
$object_box,
$output,
$thumb_grid,
$xaction_view,
$timeline,
$add_comment,
);

View file

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

View file

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

View file

@ -2,6 +2,7 @@
final class PhabricatorProject extends PhabricatorProjectDAO
implements
PhabricatorApplicationTransactionInterface,
PhabricatorFlaggableInterface,
PhabricatorPolicyInterface,
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 )----------------------------------- */
public function destroyObjectPermanently(

View file

@ -3,6 +3,7 @@
final class PhabricatorProjectColumn
extends PhabricatorProjectDAO
implements
PhabricatorApplicationTransactionInterface,
PhabricatorPolicyInterface,
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 )----------------------------------------- */