Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14033773
D9975.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D9975.diff
View Options
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
@@ -57,33 +57,67 @@
$phids = array_values($phids);
if ($edge_type) {
- if (!$object instanceof PhabricatorApplicationTransactionInterface) {
- throw new Exception(
- pht(
- 'Expected object ("%s") to implement interface "%s".',
- get_class($object),
- 'PhabricatorApplicationTransactionInterface'));
+ if ($object instanceof PhabricatorRepositoryCommit) {
+ // TODO: Remove this entire branch of special cased grossness
+ // after T4896.
+
+ $old_phids = PhabricatorEdgeQuery::loadDestinationPHIDs(
+ $this->phid,
+ $edge_type);
+ $add_phids = $phids;
+ $rem_phids = array_diff($old_phids, $add_phids);
+
+ // Doing this correctly (in a way that writes edge transactions) would
+ // be a huge mess and we don't get the commit half of the transaction
+ // anyway until T4896, so just write the edges themselves and skip
+ // the transactions for now.
+
+ $editor = new PhabricatorEdgeEditor();
+ foreach ($add_phids as $phid) {
+ $editor->addEdge(
+ $object->getPHID(),
+ DiffusionCommitHasTaskEdgeType::EDGECONST,
+ $phid);
+ }
+
+ foreach ($rem_phids as $phid) {
+ $editor->removeEdge(
+ $object->getPHID(),
+ DiffusionCommitHasTaskEdgeType::EDGECONST,
+ $phid);
+ }
+
+ $editor->save();
+
+ } else {
+ if (!$object instanceof PhabricatorApplicationTransactionInterface) {
+ throw new Exception(
+ pht(
+ 'Expected object ("%s") to implement interface "%s".',
+ get_class($object),
+ 'PhabricatorApplicationTransactionInterface'));
+ }
+
+ $old_phids = PhabricatorEdgeQuery::loadDestinationPHIDs(
+ $this->phid,
+ $edge_type);
+ $add_phids = $phids;
+ $rem_phids = array_diff($old_phids, $add_phids);
+
+ $txn_editor = $object->getApplicationTransactionEditor()
+ ->setActor($user)
+ ->setContentSourceFromRequest($request);
+ $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->getApplicationTransactionObject(),
+ array($txn_template));
}
- $old_phids = PhabricatorEdgeQuery::loadDestinationPHIDs(
- $this->phid,
- $edge_type);
- $add_phids = $phids;
- $rem_phids = array_diff($old_phids, $add_phids);
-
- $txn_editor = $object->getApplicationTransactionEditor()
- ->setActor($user)
- ->setContentSourceFromRequest($request);
- $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->getApplicationTransactionObject(),
- array($txn_template));
-
return id(new AphrontReloadResponse())->setURI($handle->getURI());
} else {
return $this->performMerge($object, $handle, $phids);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Nov 10, 8:02 PM (1 w, 1 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6739221
Default Alt Text
D9975.diff (3 KB)
Attached To
Mode
D9975: Explicitly degrade edge editing for commit/task edges until T4896
Attached
Detach File
Event Timeline
Log In to Comment