Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15410409
D8802.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
8 KB
Referenced Files
None
Subscribers
None
D8802.diff
View Options
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
@@ -2951,6 +2951,7 @@
0 => 'DifferentialDAO',
1 => 'PhabricatorPolicyInterface',
2 => 'HarbormasterBuildableInterface',
+ 3 => 'PhabricatorApplicationTransactionInterface',
),
'DifferentialDiffCreateController' => 'DifferentialController',
'DifferentialDiffProperty' => 'DifferentialDAO',
@@ -3015,6 +3016,7 @@
5 => 'HarbormasterBuildableInterface',
6 => 'PhabricatorSubscribableInterface',
7 => 'PhabricatorCustomFieldInterface',
+ 8 => 'PhabricatorApplicationTransactionInterface',
),
'DifferentialRevisionDetailView' => 'AphrontView',
'DifferentialRevisionEditController' => 'DifferentialController',
diff --git a/src/applications/differential/storage/DifferentialDiff.php b/src/applications/differential/storage/DifferentialDiff.php
--- a/src/applications/differential/storage/DifferentialDiff.php
+++ b/src/applications/differential/storage/DifferentialDiff.php
@@ -4,7 +4,8 @@
extends DifferentialDAO
implements
PhabricatorPolicyInterface,
- HarbormasterBuildableInterface {
+ HarbormasterBuildableInterface,
+ PhabricatorApplicationTransactionInterface {
protected $revisionID;
protected $authorPHID;
@@ -349,4 +350,30 @@
return null;
}
+
+/* -( PhabricatorApplicationTransactionInterface )------------------------- */
+
+
+ public function getApplicationTransactionEditor() {
+ if (!$this->getRevisionID()) {
+ return null;
+ }
+ return $this->getRevision()->getApplicationTransactionEditor();
+ }
+
+
+ public function getApplicationTransactionObject() {
+ if (!$this->getRevisionID()) {
+ return null;
+ }
+ return $this->getRevision();
+ }
+
+ public function getApplicationTransactionTemplate() {
+ if (!$this->getRevisionID()) {
+ return null;
+ }
+ return $this->getRevision()->getApplicationTransactionTemplate();
+ }
+
}
diff --git a/src/applications/differential/storage/DifferentialRevision.php b/src/applications/differential/storage/DifferentialRevision.php
--- a/src/applications/differential/storage/DifferentialRevision.php
+++ b/src/applications/differential/storage/DifferentialRevision.php
@@ -8,7 +8,8 @@
PhrequentTrackableInterface,
HarbormasterBuildableInterface,
PhabricatorSubscribableInterface,
- PhabricatorCustomFieldInterface {
+ PhabricatorCustomFieldInterface,
+ PhabricatorApplicationTransactionInterface {
protected $title = '';
protected $originalTitle;
@@ -460,4 +461,20 @@
return $this;
}
+
+/* -( PhabricatorApplicationTransactionInterface )------------------------- */
+
+
+ public function getApplicationTransactionEditor() {
+ return new DifferentialTransactionEditor();
+ }
+
+ public function getApplicationTransactionObject() {
+ return $this;
+ }
+
+ public function getApplicationTransactionTemplate() {
+ return new DifferentialTransaction();
+ }
+
}
diff --git a/src/applications/legalpad/storage/LegalpadDocument.php b/src/applications/legalpad/storage/LegalpadDocument.php
--- a/src/applications/legalpad/storage/LegalpadDocument.php
+++ b/src/applications/legalpad/storage/LegalpadDocument.php
@@ -145,11 +145,16 @@
/* -( PhabricatorApplicationTransactionInterface )------------------------- */
+
public function getApplicationTransactionEditor() {
return new LegalpadDocumentEditor();
}
public function getApplicationTransactionObject() {
+ return $this;
+ }
+
+ public function getApplicationTransactionTemplate() {
return new LegalpadTransaction();
}
diff --git a/src/applications/macro/storage/PhabricatorFileImageMacro.php b/src/applications/macro/storage/PhabricatorFileImageMacro.php
--- a/src/applications/macro/storage/PhabricatorFileImageMacro.php
+++ b/src/applications/macro/storage/PhabricatorFileImageMacro.php
@@ -68,6 +68,10 @@
}
public function getApplicationTransactionObject() {
+ return $this;
+ }
+
+ public function getApplicationTransactionTemplate() {
return new PhabricatorMacroTransaction();
}
diff --git a/src/applications/pholio/storage/PholioMock.php b/src/applications/pholio/storage/PholioMock.php
--- a/src/applications/pholio/storage/PholioMock.php
+++ b/src/applications/pholio/storage/PholioMock.php
@@ -219,6 +219,10 @@
}
public function getApplicationTransactionObject() {
+ return $this;
+ }
+
+ public function getApplicationTransactionTemplate() {
return new PholioTransaction();
}
diff --git a/src/applications/search/controller/PhabricatorSearchAttachController.php b/src/applications/search/controller/PhabricatorSearchAttachController.php
--- a/src/applications/search/controller/PhabricatorSearchAttachController.php
+++ b/src/applications/search/controller/PhabricatorSearchAttachController.php
@@ -70,13 +70,15 @@
$txn_editor = $object->getApplicationTransactionEditor()
->setActor($user)
->setContentSourceFromRequest($request);
- $txn_template = $object->getApplicationTransactionObject()
+ $txn_template = $object->getApplicationTransactionTemplate()
->setTransactionType(PhabricatorTransactions::TYPE_EDGE)
->setMetadataValue('edge:type', $edge_type)
->setNewValue(array(
'+' => array_fuse($add_phids),
'-' => array_fuse($rem_phids)));
- $txn_editor->applyTransactions($object, array($txn_template));
+ $txn_editor->applyTransactions(
+ $object->getApplicationTransactionObject(),
+ array($txn_template));
} else {
diff --git a/src/applications/subscriptions/controller/PhabricatorSubscriptionsEditController.php b/src/applications/subscriptions/controller/PhabricatorSubscriptionsEditController.php
--- a/src/applications/subscriptions/controller/PhabricatorSubscriptionsEditController.php
+++ b/src/applications/subscriptions/controller/PhabricatorSubscriptionsEditController.php
@@ -74,7 +74,7 @@
);
}
- $xaction = id($object->getApplicationTransactionObject())
+ $xaction = id($object->getApplicationTransactionTemplate())
->setTransactionType(PhabricatorTransactions::TYPE_SUBSCRIBERS)
->setNewValue($xaction_value);
@@ -83,7 +83,9 @@
->setContinueOnNoEffect(true)
->setContentSourceFromRequest($request);
- $editor->applyTransactions($object, array($xaction));
+ $editor->applyTransactions(
+ $object->getApplicationTransactionObject(),
+ array($xaction));
} else {
// TODO: Eventually, get rid of this once everything implements
diff --git a/src/applications/transactions/interface/PhabricatorApplicationTransactionInterface.php b/src/applications/transactions/interface/PhabricatorApplicationTransactionInterface.php
--- a/src/applications/transactions/interface/PhabricatorApplicationTransactionInterface.php
+++ b/src/applications/transactions/interface/PhabricatorApplicationTransactionInterface.php
@@ -1,8 +1,38 @@
<?php
+/**
+ * Allow infrastructure to apply transactions to the implementing object.
+ *
+ * For example, implementing this interface allows Subscriptions to apply CC
+ * transactions, and allows Harbormaster to apply build result notifications.
+ */
interface PhabricatorApplicationTransactionInterface {
+ /**
+ * Return a @{class:PhabricatorApplicationTransactionEditor} which can be
+ * used to apply transactions to this object.
+ *
+ * @return PhabricatorApplicationTransactionEditor Editor for this object.
+ */
public function getApplicationTransactionEditor();
+
+
+ /**
+ * Return the object to apply transactions to. Normally this is the current
+ * object (that is, `$this`), but in some cases transactions may apply to
+ * a different object: for example, @{class:DifferentialDiff} applies
+ * transactions to the associated @{class:DifferentialRevision}.
+ *
+ * @return PhabricatorLiskDAO Object to apply transactions to.
+ */
public function getApplicationTransactionObject();
+
+ /**
+ * Return a template transaction for this object.
+ *
+ * @return PhabricatorApplicationTransaction
+ */
+ public function getApplicationTransactionTemplate();
+
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mar 20 2025, 7:23 AM (4 w, 6 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7223653
Default Alt Text
D8802.diff (8 KB)
Attached To
Mode
D8802: Implement PhabricatorApplicationTransactionInterface in Differential
Attached
Detach File
Event Timeline
Log In to Comment