Page MenuHomePhabricator

D10921.diff
No OneTemporary

D10921.diff

diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -1288,6 +1288,7 @@
'PhabricatorAuthAccountView' => 'applications/auth/view/PhabricatorAuthAccountView.php',
'PhabricatorAuthApplication' => 'applications/auth/application/PhabricatorAuthApplication.php',
'PhabricatorAuthAuthFactorPHIDType' => 'applications/auth/phid/PhabricatorAuthAuthFactorPHIDType.php',
+ 'PhabricatorAuthAuthProviderPHIDType' => 'applications/auth/phid/PhabricatorAuthAuthProviderPHIDType.php',
'PhabricatorAuthConfirmLinkController' => 'applications/auth/controller/PhabricatorAuthConfirmLinkController.php',
'PhabricatorAuthController' => 'applications/auth/controller/PhabricatorAuthController.php',
'PhabricatorAuthDAO' => 'applications/auth/storage/PhabricatorAuthDAO.php',
@@ -3054,6 +3055,7 @@
'AlmanacNamesTestCase' => 'PhabricatorTestCase',
'AlmanacNetwork' => array(
'AlmanacDAO',
+ 'PhabricatorApplicationTransactionInterface',
'PhabricatorPolicyInterface',
),
'AlmanacNetworkController' => 'AlmanacController',
@@ -3927,6 +3929,7 @@
'HeraldRemarkupRule' => 'PhabricatorObjectRemarkupRule',
'HeraldRule' => array(
'HeraldDAO',
+ 'PhabricatorApplicationTransactionInterface',
'PhabricatorFlaggableInterface',
'PhabricatorPolicyInterface',
'PhabricatorDestructibleInterface',
@@ -4372,6 +4375,7 @@
'PhabricatorAuthAccountView' => 'AphrontView',
'PhabricatorAuthApplication' => 'PhabricatorApplication',
'PhabricatorAuthAuthFactorPHIDType' => 'PhabricatorPHIDType',
+ 'PhabricatorAuthAuthProviderPHIDType' => 'PhabricatorPHIDType',
'PhabricatorAuthConfirmLinkController' => 'PhabricatorAuthController',
'PhabricatorAuthController' => 'PhabricatorController',
'PhabricatorAuthDAO' => 'PhabricatorLiskDAO',
@@ -4400,6 +4404,7 @@
'PhabricatorAuthOneTimeLoginController' => 'PhabricatorAuthController',
'PhabricatorAuthProviderConfig' => array(
'PhabricatorAuthDAO',
+ 'PhabricatorApplicationTransactionInterface',
'PhabricatorPolicyInterface',
),
'PhabricatorAuthProviderConfigController' => 'PhabricatorAuthController',
@@ -5516,6 +5521,7 @@
'PhabricatorSlowvoteOption' => 'PhabricatorSlowvoteDAO',
'PhabricatorSlowvotePoll' => array(
'PhabricatorSlowvoteDAO',
+ 'PhabricatorApplicationTransactionInterface',
'PhabricatorPolicyInterface',
'PhabricatorSubscribableInterface',
'PhabricatorFlaggableInterface',
diff --git a/src/applications/almanac/controller/AlmanacBindingViewController.php b/src/applications/almanac/controller/AlmanacBindingViewController.php
--- a/src/applications/almanac/controller/AlmanacBindingViewController.php
+++ b/src/applications/almanac/controller/AlmanacBindingViewController.php
@@ -42,23 +42,17 @@
$crumbs->addTextCrumb($service->getName(), $service_uri);
$crumbs->addTextCrumb($title);
- $xactions = id(new AlmanacBindingTransactionQuery())
- ->setViewer($viewer)
- ->withObjectPHIDs(array($binding->getPHID()))
- ->execute();
-
- $xaction_view = id(new PhabricatorApplicationTransactionView())
- ->setUser($viewer)
- ->setObjectPHID($binding->getPHID())
- ->setTransactions($xactions)
- ->setShouldTerminate(true);
+ $timeline = $this->buildTransactionTimeline(
+ $binding,
+ new AlmanacBindingTransactionQuery());
+ $timeline->setShouldTerminate(true);
return $this->buildApplicationPage(
array(
$crumbs,
$box,
$this->buildAlmanacPropertiesTable($binding),
- $xaction_view,
+ $timeline,
),
array(
'title' => $title,
diff --git a/src/applications/almanac/controller/AlmanacDeviceViewController.php b/src/applications/almanac/controller/AlmanacDeviceViewController.php
--- a/src/applications/almanac/controller/AlmanacDeviceViewController.php
+++ b/src/applications/almanac/controller/AlmanacDeviceViewController.php
@@ -40,16 +40,10 @@
$crumbs = $this->buildApplicationCrumbs();
$crumbs->addTextCrumb($device->getName());
- $xactions = id(new AlmanacDeviceTransactionQuery())
- ->setViewer($viewer)
- ->withObjectPHIDs(array($device->getPHID()))
- ->execute();
-
- $xaction_view = id(new PhabricatorApplicationTransactionView())
- ->setUser($viewer)
- ->setObjectPHID($device->getPHID())
- ->setTransactions($xactions)
- ->setShouldTerminate(true);
+ $timeline = $this->buildTransactionTimeline(
+ $device,
+ new AlmanacDeviceTransactionQuery());
+ $timeline->setShouldTerminate(true);
return $this->buildApplicationPage(
array(
@@ -58,7 +52,7 @@
$interfaces,
$this->buildAlmanacPropertiesTable($device),
$this->buildSSHKeysTable($device),
- $xaction_view,
+ $timeline,
),
array(
'title' => $title,
diff --git a/src/applications/almanac/controller/AlmanacNetworkViewController.php b/src/applications/almanac/controller/AlmanacNetworkViewController.php
--- a/src/applications/almanac/controller/AlmanacNetworkViewController.php
+++ b/src/applications/almanac/controller/AlmanacNetworkViewController.php
@@ -38,22 +38,16 @@
$crumbs = $this->buildApplicationCrumbs();
$crumbs->addTextCrumb($network->getName());
- $xactions = id(new AlmanacNetworkTransactionQuery())
- ->setViewer($viewer)
- ->withObjectPHIDs(array($network->getPHID()))
- ->execute();
-
- $xaction_view = id(new PhabricatorApplicationTransactionView())
- ->setUser($viewer)
- ->setObjectPHID($network->getPHID())
- ->setTransactions($xactions)
- ->setShouldTerminate(true);
+ $timeline = $this->buildTransactionTimeline(
+ $network,
+ new AlmanacNetworkTransactionQuery());
+ $timeline->setShouldTerminate(true);
return $this->buildApplicationPage(
array(
$crumbs,
$box,
- $xaction_view,
+ $timeline,
),
array(
'title' => $title,
diff --git a/src/applications/almanac/controller/AlmanacServiceViewController.php b/src/applications/almanac/controller/AlmanacServiceViewController.php
--- a/src/applications/almanac/controller/AlmanacServiceViewController.php
+++ b/src/applications/almanac/controller/AlmanacServiceViewController.php
@@ -40,16 +40,10 @@
$crumbs = $this->buildApplicationCrumbs();
$crumbs->addTextCrumb($service->getName());
- $xactions = id(new AlmanacServiceTransactionQuery())
- ->setViewer($viewer)
- ->withObjectPHIDs(array($service->getPHID()))
- ->execute();
-
- $xaction_view = id(new PhabricatorApplicationTransactionView())
- ->setUser($viewer)
- ->setObjectPHID($service->getPHID())
- ->setTransactions($xactions)
- ->setShouldTerminate(true);
+ $timeline = $this->buildTransactionTimeline(
+ $service,
+ new AlmanacServiceTransactionQuery());
+ $timeline->setShouldTerminate(true);
return $this->buildApplicationPage(
array(
@@ -57,7 +51,7 @@
$box,
$bindings,
$this->buildAlmanacPropertiesTable($service),
- $xaction_view,
+ $timeline,
),
array(
'title' => $title,
diff --git a/src/applications/almanac/storage/AlmanacNetwork.php b/src/applications/almanac/storage/AlmanacNetwork.php
--- a/src/applications/almanac/storage/AlmanacNetwork.php
+++ b/src/applications/almanac/storage/AlmanacNetwork.php
@@ -2,7 +2,9 @@
final class AlmanacNetwork
extends AlmanacDAO
- implements PhabricatorPolicyInterface {
+ implements
+ PhabricatorApplicationTransactionInterface,
+ PhabricatorPolicyInterface {
protected $name;
protected $mailKey;
@@ -42,6 +44,22 @@
}
+/* -( PhabricatorApplicationTransactionInterface )------------------------- */
+
+
+ public function getApplicationTransactionEditor() {
+ return new AlmanacNetworkEditor();
+ }
+
+ public function getApplicationTransactionObject() {
+ return $this;
+ }
+
+ public function getApplicationTransactionTemplate() {
+ return new AlmanacNetworkTransaction();
+ }
+
+
/* -( PhabricatorPolicyInterface )----------------------------------------- */
diff --git a/src/applications/auth/controller/config/PhabricatorAuthEditController.php b/src/applications/auth/controller/config/PhabricatorAuthEditController.php
--- a/src/applications/auth/controller/config/PhabricatorAuthEditController.php
+++ b/src/applications/auth/controller/config/PhabricatorAuthEditController.php
@@ -144,7 +144,6 @@
->setContinueOnNoEffect(true)
->applyTransactions($config, $xactions);
-
if ($provider->hasSetupStep() && $is_new) {
$id = $config->getID();
$next_uri = $this->getApplicationURI('config/edit/'.$id.'/');
@@ -304,21 +303,15 @@
$crumbs = $this->buildApplicationCrumbs();
$crumbs->addTextCrumb($crumb);
- $xaction_view = null;
+ $timeline = null;
if (!$is_new) {
- $xactions = id(new PhabricatorAuthProviderConfigTransactionQuery())
- ->withObjectPHIDs(array($config->getPHID()))
- ->setViewer($viewer)
- ->execute();
-
+ $timeline = $this->buildTransactionTimeline(
+ $config,
+ new PhabricatorAuthProviderConfigTransactionQuery());
+ $xactions = $timeline->getTransactions();
foreach ($xactions as $xaction) {
$xaction->setProvider($provider);
}
-
- $xaction_view = id(new PhabricatorApplicationTransactionView())
- ->setUser($viewer)
- ->setObjectPHID($config->getPHID())
- ->setTransactions($xactions);
}
$form_box = id(new PHUIObjectBoxView())
@@ -331,7 +324,7 @@
$crumbs,
$form_box,
$footer,
- $xaction_view,
+ $timeline,
),
array(
'title' => $title,
diff --git a/src/applications/auth/phid/PhabricatorAuthAuthProviderPHIDType.php b/src/applications/auth/phid/PhabricatorAuthAuthProviderPHIDType.php
new file mode 100644
--- /dev/null
+++ b/src/applications/auth/phid/PhabricatorAuthAuthProviderPHIDType.php
@@ -0,0 +1,35 @@
+<?php
+
+final class PhabricatorAuthAuthProviderPHIDType extends PhabricatorPHIDType {
+
+ const TYPECONST = 'AUTH';
+
+ public function getTypeName() {
+ return pht('Auth Provider');
+ }
+
+ public function newObject() {
+ return new PhabricatorAuthProviderConfig();
+ }
+
+ protected function buildQueryForObjects(
+ PhabricatorObjectQuery $query,
+ array $phids) {
+
+ return id(new PhabricatorAuthProviderConfigQuery())
+ ->withPHIDs($phids);
+ }
+
+ public function loadHandles(
+ PhabricatorHandleQuery $query,
+ array $handles,
+ array $objects) {
+
+ foreach ($handles as $phid => $handle) {
+ $provider = $objects[$phid];
+
+ $handle->setName($provider->getProviderName());
+ }
+ }
+
+}
diff --git a/src/applications/auth/provider/PhabricatorOAuth2AuthProvider.php b/src/applications/auth/provider/PhabricatorOAuth2AuthProvider.php
--- a/src/applications/auth/provider/PhabricatorOAuth2AuthProvider.php
+++ b/src/applications/auth/provider/PhabricatorOAuth2AuthProvider.php
@@ -159,7 +159,7 @@
'%s set the OAuth application secret for this provider.',
$xaction->renderHandleLink($author_phid));
}
- case self::PROPERTY_APP_NOTE:
+ case self::PROPERTY_NOTE:
if (strlen($old)) {
return pht(
'%s updated the OAuth application notes for this provider.',
diff --git a/src/applications/auth/storage/PhabricatorAuthProviderConfig.php b/src/applications/auth/storage/PhabricatorAuthProviderConfig.php
--- a/src/applications/auth/storage/PhabricatorAuthProviderConfig.php
+++ b/src/applications/auth/storage/PhabricatorAuthProviderConfig.php
@@ -1,7 +1,10 @@
<?php
-final class PhabricatorAuthProviderConfig extends PhabricatorAuthDAO
- implements PhabricatorPolicyInterface {
+final class PhabricatorAuthProviderConfig
+ extends PhabricatorAuthDAO
+ implements
+ PhabricatorApplicationTransactionInterface,
+ PhabricatorPolicyInterface {
protected $providerClass;
protected $providerType;
@@ -20,7 +23,7 @@
public function generatePHID() {
return PhabricatorPHID::generateNewPHID(
- PhabricatorPHIDConstants::PHID_TYPE_AUTH);
+ PhabricatorAuthAuthProviderPHIDType::TYPECONST);
}
public function getConfiguration() {
@@ -79,6 +82,22 @@
}
+/* -( PhabricatorApplicationTransactionInterface )------------------------- */
+
+
+ public function getApplicationTransactionEditor() {
+ return new PhabricatorAuthProviderConfigEditor();
+ }
+
+ public function getApplicationTransactionObject() {
+ return $this;
+ }
+
+ public function getApplicationTransactionTemplate() {
+ return new PhabricatorAuthProviderConfigTransaction();
+ }
+
+
/* -( PhabricatorPolicyInterface )----------------------------------------- */
diff --git a/src/applications/auth/storage/PhabricatorAuthProviderConfigTransaction.php b/src/applications/auth/storage/PhabricatorAuthProviderConfigTransaction.php
--- a/src/applications/auth/storage/PhabricatorAuthProviderConfigTransaction.php
+++ b/src/applications/auth/storage/PhabricatorAuthProviderConfigTransaction.php
@@ -28,7 +28,7 @@
}
public function getApplicationTransactionType() {
- return PhabricatorPHIDConstants::PHID_TYPE_AUTH;
+ return PhabricatorAuthAuthProviderPHIDType::TYPECONST;
}
public function getApplicationTransactionCommentObject() {
diff --git a/src/applications/herald/controller/HeraldRuleViewController.php b/src/applications/herald/controller/HeraldRuleViewController.php
--- a/src/applications/herald/controller/HeraldRuleViewController.php
+++ b/src/applications/herald/controller/HeraldRuleViewController.php
@@ -51,7 +51,9 @@
->setHeader($header)
->addPropertyList($properties);
- $timeline = $this->buildTimeline($rule);
+ $timeline = $this->buildTransactionTimeline(
+ $rule,
+ new HeraldTransactionQuery());
return $this->buildApplicationPage(
array(
@@ -158,31 +160,4 @@
return $view;
}
- private function buildTimeline(HeraldRule $rule) {
- $viewer = $this->getRequest()->getUser();
-
- $xactions = id(new HeraldTransactionQuery())
- ->setViewer($viewer)
- ->withObjectPHIDs(array($rule->getPHID()))
- ->needComments(true)
- ->execute();
-
- $engine = id(new PhabricatorMarkupEngine())
- ->setViewer($viewer);
- foreach ($xactions as $xaction) {
- if ($xaction->getComment()) {
- $engine->addObject(
- $xaction->getComment(),
- PhabricatorApplicationTransactionComment::MARKUP_FIELD_COMMENT);
- }
- }
- $engine->process();
-
- return id(new PhabricatorApplicationTransactionView())
- ->setUser($viewer)
- ->setObjectPHID($rule->getPHID())
- ->setTransactions($xactions)
- ->setMarkupEngine($engine);
- }
-
}
diff --git a/src/applications/herald/storage/HeraldRule.php b/src/applications/herald/storage/HeraldRule.php
--- a/src/applications/herald/storage/HeraldRule.php
+++ b/src/applications/herald/storage/HeraldRule.php
@@ -2,6 +2,7 @@
final class HeraldRule extends HeraldDAO
implements
+ PhabricatorApplicationTransactionInterface,
PhabricatorFlaggableInterface,
PhabricatorPolicyInterface,
PhabricatorDestructibleInterface {
@@ -264,6 +265,19 @@
return sprintf('~%d%010d', $type_order, $this->getID());
}
+/* -( PhabricatorApplicationTransactionInterface )------------------------- */
+
+ public function getApplicationTransactionEditor() {
+ return new HeraldRuleEditor();
+ }
+
+ public function getApplicationTransactionObject() {
+ return $this;
+ }
+
+ public function getApplicationTransactionTemplate() {
+ return new HeraldRuleTransaction();
+ }
/* -( PhabricatorPolicyInterface )----------------------------------------- */
diff --git a/src/applications/phid/PhabricatorPHIDConstants.php b/src/applications/phid/PhabricatorPHIDConstants.php
--- a/src/applications/phid/PhabricatorPHIDConstants.php
+++ b/src/applications/phid/PhabricatorPHIDConstants.php
@@ -11,7 +11,6 @@
const PHID_TYPE_XCMT = 'XCMT';
- const PHID_TYPE_AUTH = 'AUTH';
const PHID_TYPE_XOBJ = 'XOBJ';
const PHID_TYPE_VOID = 'VOID';
diff --git a/src/applications/slowvote/controller/PhabricatorSlowvotePollController.php b/src/applications/slowvote/controller/PhabricatorSlowvotePollController.php
--- a/src/applications/slowvote/controller/PhabricatorSlowvotePollController.php
+++ b/src/applications/slowvote/controller/PhabricatorSlowvotePollController.php
@@ -54,7 +54,9 @@
$crumbs = $this->buildApplicationCrumbs();
$crumbs->addTextCrumb('V'.$poll->getID());
- $xactions = $this->buildTransactions($poll);
+ $timeline = $this->buildTransactionTimeline(
+ $poll,
+ new PhabricatorSlowvoteTransactionQuery());
$add_comment = $this->buildCommentForm($poll);
$object_box = id(new PHUIObjectBoxView())
@@ -71,7 +73,7 @@
'class' => 'mlt mml mmr',
),
$poll_view),
- $xactions,
+ $timeline,
$add_comment,
),
array(
@@ -140,34 +142,6 @@
return $view;
}
- private function buildTransactions(PhabricatorSlowvotePoll $poll) {
- $viewer = $this->getRequest()->getUser();
-
- $xactions = id(new PhabricatorSlowvoteTransactionQuery())
- ->setViewer($viewer)
- ->withObjectPHIDs(array($poll->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($poll->getPHID())
- ->setTransactions($xactions)
- ->setMarkupEngine($engine);
-
- return $timeline;
- }
-
private function buildCommentForm(PhabricatorSlowvotePoll $poll) {
$viewer = $this->getRequest()->getUser();
diff --git a/src/applications/slowvote/storage/PhabricatorSlowvotePoll.php b/src/applications/slowvote/storage/PhabricatorSlowvotePoll.php
--- a/src/applications/slowvote/storage/PhabricatorSlowvotePoll.php
+++ b/src/applications/slowvote/storage/PhabricatorSlowvotePoll.php
@@ -2,6 +2,7 @@
final class PhabricatorSlowvotePoll extends PhabricatorSlowvoteDAO
implements
+ PhabricatorApplicationTransactionInterface,
PhabricatorPolicyInterface,
PhabricatorSubscribableInterface,
PhabricatorFlaggableInterface,
@@ -103,6 +104,22 @@
}
+/* -( PhabricatorApplicationTransactionInterface )------------------------- */
+
+
+ public function getApplicationTransactionEditor() {
+ return new PhabricatorSlowvoteEditor();
+ }
+
+ public function getApplicationTransactionObject() {
+ return $this;
+ }
+
+ public function getApplicationTransactionTemplate() {
+ return new PhabricatorSlowvoteTransaction();
+ }
+
+
/* -( PhabricatorPolicyInterface )----------------------------------------- */
diff --git a/src/applications/transactions/view/PhabricatorApplicationTransactionView.php b/src/applications/transactions/view/PhabricatorApplicationTransactionView.php
--- a/src/applications/transactions/view/PhabricatorApplicationTransactionView.php
+++ b/src/applications/transactions/view/PhabricatorApplicationTransactionView.php
@@ -67,6 +67,10 @@
return $this;
}
+ public function getTransactions() {
+ return $this->transactions;
+ }
+
public function setShouldTerminate($term) {
$this->shouldTerminate = $term;
return $this;

File Metadata

Mime Type
text/plain
Expires
May 25 2024, 9:06 PM (7 w, 6 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6276683
Default Alt Text
D10921.diff (19 KB)

Event Timeline