mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-10 08:52:39 +01:00
Transactions - land buildTransactionTimeline in a bunch more apps
Summary: Ref T4712. Specifically... - Dashboards - two objects needed PhabricatorApplicationTransactionInterface - Macros - Paste - Phlux - one object needed PhabricatorApplicationTransactionInterface - added setShouldTerminate(true) - Files - one object needed PhabricatorApplicationTransactionInterface - Passphrase - one object needed PhabricatorApplicationTransactionInterface - added setShouldTerminate(true) - Drydock - one object needed PhabricatorApplicationTransactionInterface - added setShouldTerminate(true) Test Plan: foreach application, verify that the timeline(s) showed up correctly, including with appropriate setShouldTerminate-ness Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin, epriestley Maniphest Tasks: T4712 Differential Revision: https://secure.phabricator.com/D10924
This commit is contained in:
parent
c2522a89b9
commit
5e8600442d
15 changed files with 143 additions and 146 deletions
|
@ -3649,6 +3649,7 @@ phutil_register_library_map(array(
|
|||
'DrydockApacheWebrootInterface' => 'DrydockWebrootInterface',
|
||||
'DrydockBlueprint' => array(
|
||||
'DrydockDAO',
|
||||
'PhabricatorApplicationTransactionInterface',
|
||||
'PhabricatorPolicyInterface',
|
||||
'PhabricatorCustomFieldInterface',
|
||||
),
|
||||
|
@ -4240,6 +4241,7 @@ phutil_register_library_map(array(
|
|||
'PassphraseController' => 'PhabricatorController',
|
||||
'PassphraseCredential' => array(
|
||||
'PassphraseDAO',
|
||||
'PhabricatorApplicationTransactionInterface',
|
||||
'PhabricatorPolicyInterface',
|
||||
'PhabricatorDestructibleInterface',
|
||||
),
|
||||
|
@ -4657,6 +4659,7 @@ phutil_register_library_map(array(
|
|||
'PhabricatorDaemonsApplication' => 'PhabricatorApplication',
|
||||
'PhabricatorDashboard' => array(
|
||||
'PhabricatorDashboardDAO',
|
||||
'PhabricatorApplicationTransactionInterface',
|
||||
'PhabricatorPolicyInterface',
|
||||
'PhabricatorDestructibleInterface',
|
||||
),
|
||||
|
@ -4675,6 +4678,7 @@ phutil_register_library_map(array(
|
|||
'PhabricatorDashboardMovePanelController' => 'PhabricatorDashboardController',
|
||||
'PhabricatorDashboardPanel' => array(
|
||||
'PhabricatorDashboardDAO',
|
||||
'PhabricatorApplicationTransactionInterface',
|
||||
'PhabricatorPolicyInterface',
|
||||
'PhabricatorCustomFieldInterface',
|
||||
'PhabricatorDestructibleInterface',
|
||||
|
@ -4808,6 +4812,7 @@ phutil_register_library_map(array(
|
|||
'PhabricatorFeedStoryTypeConstants' => 'PhabricatorFeedConstants',
|
||||
'PhabricatorFile' => array(
|
||||
'PhabricatorFileDAO',
|
||||
'PhabricatorApplicationTransactionInterface',
|
||||
'PhabricatorTokenReceiverInterface',
|
||||
'PhabricatorSubscribableInterface',
|
||||
'PhabricatorFlaggableInterface',
|
||||
|
@ -5773,6 +5778,7 @@ phutil_register_library_map(array(
|
|||
'PhluxTransactionQuery' => 'PhabricatorApplicationTransactionQuery',
|
||||
'PhluxVariable' => array(
|
||||
'PhluxDAO',
|
||||
'PhabricatorApplicationTransactionInterface',
|
||||
'PhabricatorFlaggableInterface',
|
||||
'PhabricatorPolicyInterface',
|
||||
),
|
||||
|
|
|
@ -35,7 +35,10 @@ final class PhabricatorDashboardHistoryController
|
|||
$dashboard_manage_uri);
|
||||
$crumbs->addTextCrumb(pht('History'));
|
||||
|
||||
$timeline = $this->buildTransactions($dashboard);
|
||||
$timeline = $this->buildTransactionTimeline(
|
||||
$dashboard,
|
||||
new PhabricatorDashboardTransactionQuery());
|
||||
$timeline->setShouldTerminate(true);
|
||||
|
||||
return $this->buildApplicationPage(
|
||||
array(
|
||||
|
@ -47,21 +50,4 @@ final class PhabricatorDashboardHistoryController
|
|||
));
|
||||
}
|
||||
|
||||
private function buildTransactions(PhabricatorDashboard $dashboard) {
|
||||
$viewer = $this->getRequest()->getUser();
|
||||
|
||||
$xactions = id(new PhabricatorDashboardTransactionQuery())
|
||||
->setViewer($viewer)
|
||||
->withObjectPHIDs(array($dashboard->getPHID()))
|
||||
->execute();
|
||||
|
||||
$timeline = id(new PhabricatorApplicationTransactionView())
|
||||
->setUser($viewer)
|
||||
->setShouldTerminate(true)
|
||||
->setObjectPHID($dashboard->getPHID())
|
||||
->setTransactions($xactions);
|
||||
|
||||
return $timeline;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -35,7 +35,10 @@ final class PhabricatorDashboardPanelViewController
|
|||
$header = $this->buildHeaderView($panel);
|
||||
$actions = $this->buildActionView($panel);
|
||||
$properties = $this->buildPropertyView($panel);
|
||||
$timeline = $this->buildTransactions($panel);
|
||||
$timeline = $this->buildTransactionTimeline(
|
||||
$panel,
|
||||
new PhabricatorDashboardPanelTransactionQuery());
|
||||
$timeline->setShouldTerminate(true);
|
||||
|
||||
$properties->setActionList($actions);
|
||||
$box = id(new PHUIObjectBoxView())
|
||||
|
@ -167,24 +170,4 @@ final class PhabricatorDashboardPanelViewController
|
|||
return $properties;
|
||||
}
|
||||
|
||||
private function buildTransactions(PhabricatorDashboardPanel $panel) {
|
||||
$viewer = $this->getRequest()->getUser();
|
||||
|
||||
$xactions = id(new PhabricatorDashboardPanelTransactionQuery())
|
||||
->setViewer($viewer)
|
||||
->withObjectPHIDs(array($panel->getPHID()))
|
||||
->execute();
|
||||
|
||||
$engine = id(new PhabricatorMarkupEngine())
|
||||
->setViewer($viewer);
|
||||
|
||||
$timeline = id(new PhabricatorApplicationTransactionView())
|
||||
->setUser($viewer)
|
||||
->setShouldTerminate(true)
|
||||
->setObjectPHID($panel->getPHID())
|
||||
->setTransactions($xactions);
|
||||
|
||||
return $timeline;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
*/
|
||||
final class PhabricatorDashboard extends PhabricatorDashboardDAO
|
||||
implements
|
||||
PhabricatorApplicationTransactionInterface,
|
||||
PhabricatorPolicyInterface,
|
||||
PhabricatorDestructibleInterface {
|
||||
|
||||
|
@ -83,6 +84,22 @@ final class PhabricatorDashboard extends PhabricatorDashboardDAO
|
|||
}
|
||||
|
||||
|
||||
/* -( PhabricatorApplicationTransactionInterface )------------------------- */
|
||||
|
||||
|
||||
public function getApplicationTransactionEditor() {
|
||||
return new PhabricatorDashboardTransactionEditor();
|
||||
}
|
||||
|
||||
public function getApplicationTransactionObject() {
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getApplicationTransactionTemplate() {
|
||||
return new PhabricatorDashboardTransaction();
|
||||
}
|
||||
|
||||
|
||||
/* -( PhabricatorPolicyInterface )----------------------------------------- */
|
||||
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
final class PhabricatorDashboardPanel
|
||||
extends PhabricatorDashboardDAO
|
||||
implements
|
||||
PhabricatorApplicationTransactionInterface,
|
||||
PhabricatorPolicyInterface,
|
||||
PhabricatorCustomFieldInterface,
|
||||
PhabricatorDestructibleInterface {
|
||||
|
@ -89,6 +90,22 @@ final class PhabricatorDashboardPanel
|
|||
}
|
||||
|
||||
|
||||
/* -( PhabricatorApplicationTransactionInterface )------------------------- */
|
||||
|
||||
|
||||
public function getApplicationTransactionEditor() {
|
||||
return new PhabricatorDashboardPanelTransactionEditor();
|
||||
}
|
||||
|
||||
public function getApplicationTransactionObject() {
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getApplicationTransactionTemplate() {
|
||||
return new PhabricatorDashboardPanelTransaction();
|
||||
}
|
||||
|
||||
|
||||
/* -( PhabricatorPolicyInterface )----------------------------------------- */
|
||||
|
||||
|
||||
|
|
|
@ -56,11 +56,6 @@ final class DrydockBlueprintViewController extends DrydockBlueprintController {
|
|||
->setHeader($header)
|
||||
->addPropertyList($properties);
|
||||
|
||||
$xactions = id(new DrydockBlueprintTransactionQuery())
|
||||
->setViewer($viewer)
|
||||
->withObjectPHIDs(array($blueprint->getPHID()))
|
||||
->execute();
|
||||
|
||||
$field_list = PhabricatorCustomField::getObjectFields(
|
||||
$blueprint,
|
||||
PhabricatorCustomField::ROLE_VIEW);
|
||||
|
@ -73,14 +68,10 @@ final class DrydockBlueprintViewController extends DrydockBlueprintController {
|
|||
$viewer,
|
||||
$properties);
|
||||
|
||||
$engine = id(new PhabricatorMarkupEngine())
|
||||
->setViewer($viewer);
|
||||
|
||||
$timeline = id(new PhabricatorApplicationTransactionView())
|
||||
->setUser($viewer)
|
||||
->setObjectPHID($blueprint->getPHID())
|
||||
->setTransactions($xactions)
|
||||
->setMarkupEngine($engine);
|
||||
$timeline = $this->buildTransactionTimeline(
|
||||
$blueprint,
|
||||
new DrydockBlueprintTransactionQuery());
|
||||
$timeline->setShouldTerminate(true);
|
||||
|
||||
return $this->buildApplicationPage(
|
||||
array(
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
final class DrydockBlueprint extends DrydockDAO
|
||||
implements
|
||||
PhabricatorApplicationTransactionInterface,
|
||||
PhabricatorPolicyInterface,
|
||||
PhabricatorCustomFieldInterface {
|
||||
|
||||
|
@ -75,6 +76,22 @@ final class DrydockBlueprint extends DrydockDAO
|
|||
}
|
||||
|
||||
|
||||
/* -( PhabricatorApplicationTransactionInterface )------------------------- */
|
||||
|
||||
|
||||
public function getApplicationTransactionEditor() {
|
||||
return new DrydockBlueprintEditor();
|
||||
}
|
||||
|
||||
public function getApplicationTransactionObject() {
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getApplicationTransactionTemplate() {
|
||||
return new DrydockBlueprintTransaction();
|
||||
}
|
||||
|
||||
|
||||
/* -( PhabricatorPolicyInterface )----------------------------------------- */
|
||||
|
||||
|
||||
|
|
|
@ -38,10 +38,6 @@ final class PhabricatorFileInfoController extends PhabricatorFileController {
|
|||
}
|
||||
|
||||
$phid = $file->getPHID();
|
||||
$xactions = id(new PhabricatorFileTransactionQuery())
|
||||
->setViewer($user)
|
||||
->withObjectPHIDs(array($phid))
|
||||
->execute();
|
||||
|
||||
$handle_phids = array_merge(
|
||||
array($file->getAuthorPHID()),
|
||||
|
@ -62,7 +58,7 @@ final class PhabricatorFileInfoController extends PhabricatorFileController {
|
|||
}
|
||||
|
||||
$actions = $this->buildActionView($file);
|
||||
$timeline = $this->buildTransactionView($file, $xactions);
|
||||
$timeline = $this->buildTransactionView($file);
|
||||
$crumbs = $this->buildApplicationCrumbs();
|
||||
$crumbs->setActionList($actions);
|
||||
$crumbs->addTextCrumb(
|
||||
|
@ -86,27 +82,12 @@ final class PhabricatorFileInfoController extends PhabricatorFileController {
|
|||
));
|
||||
}
|
||||
|
||||
private function buildTransactionView(
|
||||
PhabricatorFile $file,
|
||||
array $xactions) {
|
||||
|
||||
private function buildTransactionView(PhabricatorFile $file) {
|
||||
$user = $this->getRequest()->getUser();
|
||||
$engine = id(new PhabricatorMarkupEngine())
|
||||
->setViewer($user);
|
||||
foreach ($xactions as $xaction) {
|
||||
if ($xaction->getComment()) {
|
||||
$engine->addObject(
|
||||
$xaction->getComment(),
|
||||
PhabricatorApplicationTransactionComment::MARKUP_FIELD_COMMENT);
|
||||
}
|
||||
}
|
||||
$engine->process();
|
||||
|
||||
$timeline = id(new PhabricatorApplicationTransactionView())
|
||||
->setUser($user)
|
||||
->setObjectPHID($file->getPHID())
|
||||
->setTransactions($xactions)
|
||||
->setMarkupEngine($engine);
|
||||
$timeline = $this->buildTransactionTimeline(
|
||||
$file,
|
||||
new PhabricatorFileTransactionQuery());
|
||||
|
||||
$is_serious = PhabricatorEnv::getEnvConfig('phabricator.serious-business');
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
*/
|
||||
final class PhabricatorFile extends PhabricatorFileDAO
|
||||
implements
|
||||
PhabricatorApplicationTransactionInterface,
|
||||
PhabricatorTokenReceiverInterface,
|
||||
PhabricatorSubscribableInterface,
|
||||
PhabricatorFlaggableInterface,
|
||||
|
@ -1079,6 +1080,22 @@ final class PhabricatorFile extends PhabricatorFileDAO
|
|||
}
|
||||
|
||||
|
||||
/* -( PhabricatorApplicationTransactionInterface )------------------------- */
|
||||
|
||||
|
||||
public function getApplicationTransactionEditor() {
|
||||
return new PhabricatorFileEditor();
|
||||
}
|
||||
|
||||
public function getApplicationTransactionObject() {
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getApplicationTransactionTemplate() {
|
||||
return new PhabricatorFileTransaction();
|
||||
}
|
||||
|
||||
|
||||
/* -( PhabricatorPolicyInterface Implementation )-------------------------- */
|
||||
|
||||
|
||||
|
|
|
@ -51,27 +51,9 @@ final class PhabricatorMacroViewController
|
|||
)));
|
||||
}
|
||||
|
||||
$xactions = id(new PhabricatorMacroTransactionQuery())
|
||||
->setViewer($request->getUser())
|
||||
->withObjectPHIDs(array($macro->getPHID()))
|
||||
->execute();
|
||||
|
||||
$engine = id(new PhabricatorMarkupEngine())
|
||||
->setViewer($user);
|
||||
foreach ($xactions as $xaction) {
|
||||
if ($xaction->getComment()) {
|
||||
$engine->addObject(
|
||||
$xaction->getComment(),
|
||||
PhabricatorApplicationTransactionComment::MARKUP_FIELD_COMMENT);
|
||||
}
|
||||
}
|
||||
$engine->process();
|
||||
|
||||
$timeline = id(new PhabricatorApplicationTransactionView())
|
||||
->setUser($user)
|
||||
->setObjectPHID($macro->getPHID())
|
||||
->setTransactions($xactions)
|
||||
->setMarkupEngine($engine);
|
||||
$timeline = $this->buildTransactionTimeline(
|
||||
$macro,
|
||||
new PhabricatorMacroTransactionQuery());
|
||||
|
||||
$header = id(new PHUIHeaderView())
|
||||
->setUser($user)
|
||||
|
|
|
@ -26,18 +26,10 @@ final class PassphraseCredentialViewController extends PassphraseController {
|
|||
throw new Exception(pht('Credential has invalid type "%s"!', $type));
|
||||
}
|
||||
|
||||
$xactions = id(new PassphraseCredentialTransactionQuery())
|
||||
->setViewer($viewer)
|
||||
->withObjectPHIDs(array($credential->getPHID()))
|
||||
->execute();
|
||||
|
||||
$engine = id(new PhabricatorMarkupEngine())
|
||||
->setViewer($viewer);
|
||||
|
||||
$timeline = id(new PhabricatorApplicationTransactionView())
|
||||
->setUser($viewer)
|
||||
->setObjectPHID($credential->getPHID())
|
||||
->setTransactions($xactions);
|
||||
$timeline = $this->buildTransactionTimeline(
|
||||
$credential,
|
||||
new PassphraseCredentialTransactionQuery());
|
||||
$timeline->setShouldTerminate(true);
|
||||
|
||||
$title = pht('%s %s', 'K'.$credential->getID(), $credential->getName());
|
||||
$crumbs = $this->buildApplicationCrumbs();
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
<?php
|
||||
|
||||
final class PassphraseCredential extends PassphraseDAO
|
||||
implements PhabricatorPolicyInterface,
|
||||
PhabricatorDestructibleInterface {
|
||||
implements
|
||||
PhabricatorApplicationTransactionInterface,
|
||||
PhabricatorPolicyInterface,
|
||||
PhabricatorDestructibleInterface {
|
||||
|
||||
protected $name;
|
||||
protected $credentialType;
|
||||
|
@ -81,6 +83,22 @@ final class PassphraseCredential extends PassphraseDAO
|
|||
}
|
||||
|
||||
|
||||
/* -( PhabricatorApplicationTransactionInterface )------------------------- */
|
||||
|
||||
|
||||
public function getApplicationTransactionEditor() {
|
||||
return new PassphraseCredentialTransactionEditor();
|
||||
}
|
||||
|
||||
public function getApplicationTransactionObject() {
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getApplicationTransactionTemplate() {
|
||||
return new PassphraseCredentialTransaction();
|
||||
}
|
||||
|
||||
|
||||
/* -( PhabricatorPolicyInterface )----------------------------------------- */
|
||||
|
||||
|
||||
|
|
|
@ -90,27 +90,9 @@ final class PhabricatorPasteViewController extends PhabricatorPasteController {
|
|||
->setActionList($actions)
|
||||
->addTextCrumb('P'.$paste->getID(), '/P'.$paste->getID());
|
||||
|
||||
$xactions = id(new PhabricatorPasteTransactionQuery())
|
||||
->setViewer($request->getUser())
|
||||
->withObjectPHIDs(array($paste->getPHID()))
|
||||
->execute();
|
||||
|
||||
$engine = id(new PhabricatorMarkupEngine())
|
||||
->setViewer($user);
|
||||
foreach ($xactions as $xaction) {
|
||||
if ($xaction->getComment()) {
|
||||
$engine->addObject(
|
||||
$xaction->getComment(),
|
||||
PhabricatorApplicationTransactionComment::MARKUP_FIELD_COMMENT);
|
||||
}
|
||||
}
|
||||
$engine->process();
|
||||
|
||||
$timeline = id(new PhabricatorApplicationTransactionView())
|
||||
->setUser($user)
|
||||
->setObjectPHID($paste->getPHID())
|
||||
->setTransactions($xactions)
|
||||
->setMarkupEngine($engine);
|
||||
$timeline = $this->buildTransactionTimeline(
|
||||
$paste,
|
||||
new PhabricatorPasteTransactionQuery());
|
||||
|
||||
$is_serious = PhabricatorEnv::getEnvConfig('phabricator.serious-business');
|
||||
|
||||
|
|
|
@ -58,19 +58,10 @@ final class PhluxViewController extends PhluxController {
|
|||
->setActionList($actions)
|
||||
->addProperty(pht('Value'), $display_value);
|
||||
|
||||
$xactions = id(new PhluxTransactionQuery())
|
||||
->setViewer($user)
|
||||
->withObjectPHIDs(array($var->getPHID()))
|
||||
->execute();
|
||||
|
||||
$engine = id(new PhabricatorMarkupEngine())
|
||||
->setViewer($user);
|
||||
|
||||
$xaction_view = id(new PhabricatorApplicationTransactionView())
|
||||
->setUser($user)
|
||||
->setObjectPHID($var->getPHID())
|
||||
->setTransactions($xactions)
|
||||
->setMarkupEngine($engine);
|
||||
$timeline = $this->buildTransactionTimeline(
|
||||
$var,
|
||||
new PhluxTransactionQuery());
|
||||
$timeline->setShouldTerminate(true);
|
||||
|
||||
$object_box = id(new PHUIObjectBoxView())
|
||||
->setHeader($header)
|
||||
|
@ -80,7 +71,7 @@ final class PhluxViewController extends PhluxController {
|
|||
array(
|
||||
$crumbs,
|
||||
$object_box,
|
||||
$xaction_view,
|
||||
$timeline,
|
||||
),
|
||||
array(
|
||||
'title' => $title,
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
final class PhluxVariable extends PhluxDAO
|
||||
implements
|
||||
PhabricatorApplicationTransactionInterface,
|
||||
PhabricatorFlaggableInterface,
|
||||
PhabricatorPolicyInterface {
|
||||
|
||||
|
@ -33,6 +34,22 @@ final class PhluxVariable extends PhluxDAO
|
|||
}
|
||||
|
||||
|
||||
/* -( PhabricatorApplicationTransactionInterface )------------------------- */
|
||||
|
||||
|
||||
public function getApplicationTransactionEditor() {
|
||||
return new PhluxVariableEditor();
|
||||
}
|
||||
|
||||
public function getApplicationTransactionObject() {
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getApplicationTransactionTemplate() {
|
||||
return new PhluxTransaction();
|
||||
}
|
||||
|
||||
|
||||
/* -( PhabricatorPolicyInterface )----------------------------------------- */
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue