Page MenuHomePhabricator

D9839.id23603.diff
No OneTemporary

D9839.id23603.diff

diff --git a/resources/sql/patches/migrate-maniphest-revisions.php b/resources/sql/patches/migrate-maniphest-revisions.php
--- a/resources/sql/patches/migrate-maniphest-revisions.php
+++ b/resources/sql/patches/migrate-maniphest-revisions.php
@@ -19,7 +19,7 @@
foreach ($revs as $rev) {
$editor->addEdge(
$task->getPHID(),
- PhabricatorEdgeConfig::TYPE_TASK_HAS_RELATED_DREV,
+ ManiphestEdgeTypeTaskHasRevision::EDGECONST,
$rev);
}
$editor->save();
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
@@ -378,6 +378,7 @@
'DifferentialDiffViewController' => 'applications/differential/controller/DifferentialDiffViewController.php',
'DifferentialDoorkeeperRevisionFeedStoryPublisher' => 'applications/differential/doorkeeper/DifferentialDoorkeeperRevisionFeedStoryPublisher.php',
'DifferentialDraft' => 'applications/differential/storage/DifferentialDraft.php',
+ 'DifferentialEdgeTypeRevisionHasTask' => 'applications/differential/edge/DifferentialEdgeTypeRevisionHasTask.php',
'DifferentialEditPolicyField' => 'applications/differential/customfield/DifferentialEditPolicyField.php',
'DifferentialFieldParseException' => 'applications/differential/exception/DifferentialFieldParseException.php',
'DifferentialFieldValidationException' => 'applications/differential/exception/DifferentialFieldValidationException.php',
@@ -919,6 +920,7 @@
'ManiphestCustomFieldStorage' => 'applications/maniphest/storage/ManiphestCustomFieldStorage.php',
'ManiphestCustomFieldStringIndex' => 'applications/maniphest/storage/ManiphestCustomFieldStringIndex.php',
'ManiphestDAO' => 'applications/maniphest/storage/ManiphestDAO.php',
+ 'ManiphestEdgeTypeTaskHasRevision' => 'applications/maniphest/edge/ManiphestEdgeTypeTaskHasRevision.php',
'ManiphestExcelDefaultFormat' => 'applications/maniphest/export/ManiphestExcelDefaultFormat.php',
'ManiphestExcelFormat' => 'applications/maniphest/export/ManiphestExcelFormat.php',
'ManiphestExportController' => 'applications/maniphest/controller/ManiphestExportController.php',
@@ -3085,6 +3087,7 @@
'DifferentialDiffViewController' => 'DifferentialController',
'DifferentialDoorkeeperRevisionFeedStoryPublisher' => 'DoorkeeperFeedStoryPublisher',
'DifferentialDraft' => 'DifferentialDAO',
+ 'DifferentialEdgeTypeRevisionHasTask' => 'PhabricatorEdgeType',
'DifferentialEditPolicyField' => 'DifferentialCoreCustomField',
'DifferentialFieldParseException' => 'Exception',
'DifferentialFieldValidationException' => 'Exception',
@@ -3688,6 +3691,7 @@
'ManiphestCustomFieldStorage' => 'PhabricatorCustomFieldStorage',
'ManiphestCustomFieldStringIndex' => 'PhabricatorCustomFieldStringIndexStorage',
'ManiphestDAO' => 'PhabricatorLiskDAO',
+ 'ManiphestEdgeTypeTaskHasRevision' => 'PhabricatorEdgeType',
'ManiphestExcelDefaultFormat' => 'ManiphestExcelFormat',
'ManiphestExportController' => 'ManiphestController',
'ManiphestHovercardEventListener' => 'PhabricatorEventListener',
diff --git a/src/applications/differential/customfield/DifferentialManiphestTasksField.php b/src/applications/differential/customfield/DifferentialManiphestTasksField.php
--- a/src/applications/differential/customfield/DifferentialManiphestTasksField.php
+++ b/src/applications/differential/customfield/DifferentialManiphestTasksField.php
@@ -42,7 +42,7 @@
return PhabricatorEdgeQuery::loadDestinationPHIDs(
$revision->getPHID(),
- PhabricatorEdgeConfig::TYPE_DREV_HAS_RELATED_TASK);
+ DifferentialEdgeTypeRevisionHasTask::EDGECONST);
}
public function getApplicationTransactionType() {
@@ -51,7 +51,7 @@
public function getApplicationTransactionMetadata() {
return array(
- 'edge:type' => PhabricatorEdgeConfig::TYPE_DREV_HAS_RELATED_TASK,
+ 'edge:type' => DifferentialEdgeTypeRevisionHasTask::EDGECONST,
);
}
diff --git a/src/applications/differential/edge/DifferentialEdgeTypeRevisionHasTask.php b/src/applications/differential/edge/DifferentialEdgeTypeRevisionHasTask.php
new file mode 100644
--- /dev/null
+++ b/src/applications/differential/edge/DifferentialEdgeTypeRevisionHasTask.php
@@ -0,0 +1,109 @@
+<?php
+
+final class DifferentialEdgeTypeRevisionHasTask extends PhabricatorEdgeType {
+
+ const EDGECONST = 12;
+
+ public function getEdgeConstant() {
+ return self::EDGECONST;
+ }
+
+ public function getInverseEdgeConstant() {
+ return ManiphestEdgeTypeTaskHasRevision::EDGECONST;
+ }
+
+ public function shouldWriteInverseTransactions() {
+ return true;
+ }
+
+ public function getTransactionAddString(
+ $actor,
+ $add_count,
+ $add_edges) {
+
+ return pht(
+ '%s added %s task(s): %s.',
+ $actor,
+ $add_count,
+ $add_edges);
+ }
+
+ public function getTransactionRemoveString(
+ $actor,
+ $rem_count,
+ $rem_edges) {
+
+ return pht(
+ '%s removed %s task(s): %s.',
+ $actor,
+ $rem_count,
+ $rem_edges);
+ }
+
+ public function getTransactionEditString(
+ $actor,
+ $total_count,
+ $add_count,
+ $add_edges,
+ $rem_count,
+ $rem_edges) {
+
+ return pht(
+ '%s edited %s task(s), added %s: %s; removed %s: %s.',
+ $actor,
+ $total_count,
+ $add_count,
+ $add_edges,
+ $rem_count,
+ $rem_edges);
+ }
+
+ public function getFeedAddString(
+ $actor,
+ $object,
+ $add_count,
+ $add_edges) {
+
+ return pht(
+ '%s added %s task(s) to %s: %s.',
+ $actor,
+ $add_count,
+ $object,
+ $add_edges);
+ }
+
+ public function getFeedRemoveString(
+ $actor,
+ $object,
+ $rem_count,
+ $rem_edges) {
+
+ return pht(
+ '%s removed %s task(s) from %s: %s.',
+ $actor,
+ $object,
+ $rem_count,
+ $rem_edges);
+ }
+
+ public function getFeedEditString(
+ $actor,
+ $object,
+ $total_count,
+ $add_count,
+ $add_edges,
+ $rem_count,
+ $rem_edges) {
+
+ return pht(
+ '%s edited %s task(s) for %s, added %s: %s; removed %s: %s.',
+ $actor,
+ $total_count,
+ $object,
+ $add_count,
+ $add_edges,
+ $rem_count,
+ $rem_edges);
+ }
+
+}
diff --git a/src/applications/differential/editor/DifferentialTransactionEditor.php b/src/applications/differential/editor/DifferentialTransactionEditor.php
--- a/src/applications/differential/editor/DifferentialTransactionEditor.php
+++ b/src/applications/differential/editor/DifferentialTransactionEditor.php
@@ -254,7 +254,7 @@
$status_plan = ArcanistDifferentialRevisionStatus::CHANGES_PLANNED;
$edge_reviewer = PhabricatorEdgeConfig::TYPE_DREV_HAS_REVIEWER;
- $edge_ref_task = PhabricatorEdgeConfig::TYPE_DREV_HAS_RELATED_TASK;
+ $edge_ref_task = DifferentialEdgeTypeRevisionHasTask::EDGECONST;
$is_sticky_accept = PhabricatorEnv::getEnvConfig(
'differential.sticky-accept');
@@ -1250,7 +1250,7 @@
->execute();
if ($tasks) {
- $edge_related = PhabricatorEdgeConfig::TYPE_DREV_HAS_RELATED_TASK;
+ $edge_related = DifferentialEdgeTypeRevisionHasTask::EDGECONST;
$edges[$edge_related] = mpull($tasks, 'getPHID', 'getPHID');
}
}
diff --git a/src/applications/differential/event/DifferentialHovercardEventListener.php b/src/applications/differential/event/DifferentialHovercardEventListener.php
--- a/src/applications/differential/event/DifferentialHovercardEventListener.php
+++ b/src/applications/differential/event/DifferentialHovercardEventListener.php
@@ -28,7 +28,7 @@
$rev->loadRelationships();
$reviewer_phids = $rev->getReviewers();
- $e_task = PhabricatorEdgeConfig::TYPE_DREV_HAS_RELATED_TASK;
+ $e_task = DifferentialEdgeTypeRevisionHasTask::EDGECONST;
$edge_query = id(new PhabricatorEdgeQuery())
->withSourcePHIDs(array($phid))
->withEdgeTypes(
diff --git a/src/applications/maniphest/controller/ManiphestTaskDetailController.php b/src/applications/maniphest/controller/ManiphestTaskDetailController.php
--- a/src/applications/maniphest/controller/ManiphestTaskDetailController.php
+++ b/src/applications/maniphest/controller/ManiphestTaskDetailController.php
@@ -54,7 +54,7 @@
$e_commit = PhabricatorEdgeConfig::TYPE_TASK_HAS_COMMIT;
$e_dep_on = PhabricatorEdgeConfig::TYPE_TASK_DEPENDS_ON_TASK;
$e_dep_by = PhabricatorEdgeConfig::TYPE_TASK_DEPENDED_ON_BY_TASK;
- $e_rev = PhabricatorEdgeConfig::TYPE_TASK_HAS_RELATED_DREV;
+ $e_rev = ManiphestEdgeTypeTaskHasRevision::EDGECONST;
$e_mock = PhabricatorEdgeConfig::TYPE_TASK_HAS_MOCK;
$phid = $task->getPHID();
@@ -588,13 +588,13 @@
$edge_types = array(
PhabricatorEdgeConfig::TYPE_TASK_DEPENDED_ON_BY_TASK
- => pht('Blocks'),
+ => pht('Blocks'),
PhabricatorEdgeConfig::TYPE_TASK_DEPENDS_ON_TASK
- => pht('Blocked By'),
- PhabricatorEdgeConfig::TYPE_TASK_HAS_RELATED_DREV
- => pht('Differential Revisions'),
+ => pht('Blocked By'),
+ ManiphestEdgeTypeTaskHasRevision::EDGECONST
+ => pht('Differential Revisions'),
PhabricatorEdgeConfig::TYPE_TASK_HAS_MOCK
- => pht('Pholio Mocks'),
+ => pht('Pholio Mocks'),
);
$revisions_commits = array();
@@ -614,7 +614,7 @@
$revision_phid = key($drev_edges[$phid][$commit_drev]);
$revision_handle = idx($handles, $revision_phid);
if ($revision_handle) {
- $task_drev = PhabricatorEdgeConfig::TYPE_TASK_HAS_RELATED_DREV;
+ $task_drev = ManiphestEdgeTypeTaskHasRevision::EDGECONST;
unset($edges[$task_drev][$revision_phid]);
$revisions_commits[$phid] = hsprintf(
'%s / %s',
diff --git a/src/applications/maniphest/edge/ManiphestEdgeTypeTaskHasRevision.php b/src/applications/maniphest/edge/ManiphestEdgeTypeTaskHasRevision.php
new file mode 100644
--- /dev/null
+++ b/src/applications/maniphest/edge/ManiphestEdgeTypeTaskHasRevision.php
@@ -0,0 +1,109 @@
+<?php
+
+final class ManiphestEdgeTypeTaskHasRevision extends PhabricatorEdgeType {
+
+ const EDGECONST = 11;
+
+ public function getEdgeConstant() {
+ return self::EDGECONST;
+ }
+
+ public function getInverseEdgeConstant() {
+ return DifferentialEdgeTypeRevisionHasTask::EDGECONST;
+ }
+
+ public function shouldWriteInverseTransactions() {
+ return true;
+ }
+
+ public function getTransactionAddString(
+ $actor,
+ $add_count,
+ $add_edges) {
+
+ return pht(
+ '%s added %s revision(s): %s.',
+ $actor,
+ $add_count,
+ $add_edges);
+ }
+
+ public function getTransactionRemoveString(
+ $actor,
+ $rem_count,
+ $rem_edges) {
+
+ return pht(
+ '%s removed %s revision(s): %s.',
+ $actor,
+ $rem_count,
+ $rem_edges);
+ }
+
+ public function getTransactionEditString(
+ $actor,
+ $total_count,
+ $add_count,
+ $add_edges,
+ $rem_count,
+ $rem_edges) {
+
+ return pht(
+ '%s edited %s revision(s), added %s: %s; removed %s: %s.',
+ $actor,
+ $total_count,
+ $add_count,
+ $add_edges,
+ $rem_count,
+ $rem_edges);
+ }
+
+ public function getFeedAddString(
+ $actor,
+ $object,
+ $add_count,
+ $add_edges) {
+
+ return pht(
+ '%s added %s revision(s) to %s: %s.',
+ $actor,
+ $add_count,
+ $object,
+ $add_edges);
+ }
+
+ public function getFeedRemoveString(
+ $actor,
+ $object,
+ $rem_count,
+ $rem_edges) {
+
+ return pht(
+ '%s removed %s revision(s) from %s: %s.',
+ $actor,
+ $object,
+ $rem_count,
+ $rem_edges);
+ }
+
+ public function getFeedEditString(
+ $actor,
+ $object,
+ $total_count,
+ $add_count,
+ $add_edges,
+ $rem_count,
+ $rem_edges) {
+
+ return pht(
+ '%s edited %s revision(s) for %s, added %s: %s; removed %s: %s.',
+ $actor,
+ $total_count,
+ $object,
+ $add_count,
+ $add_edges,
+ $rem_count,
+ $rem_edges);
+ }
+
+}
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
@@ -298,12 +298,12 @@
$t_task => array(
$t_cmit => PhabricatorEdgeConfig::TYPE_TASK_HAS_COMMIT,
$t_task => PhabricatorEdgeConfig::TYPE_TASK_DEPENDS_ON_TASK,
- $t_drev => PhabricatorEdgeConfig::TYPE_TASK_HAS_RELATED_DREV,
+ $t_drev => ManiphestEdgeTypeTaskHasRevision::EDGECONST,
$t_mock => PhabricatorEdgeConfig::TYPE_TASK_HAS_MOCK,
),
$t_drev => array(
$t_drev => PhabricatorEdgeConfig::TYPE_DREV_DEPENDS_ON_DREV,
- $t_task => PhabricatorEdgeConfig::TYPE_DREV_HAS_RELATED_TASK,
+ $t_task => DifferentialEdgeTypeRevisionHasTask::EDGECONST,
),
$t_mock => array(
$t_task => PhabricatorEdgeConfig::TYPE_MOCK_HAS_TASK,
diff --git a/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php b/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php
--- a/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php
+++ b/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php
@@ -24,6 +24,7 @@
private $isPreview;
private $isHeraldEditor;
+ private $isInverseEdgeEditor;
private $actingAsPHID;
private $disableEmail;
@@ -120,6 +121,15 @@
return $this->isPreview;
}
+ public function setIsInverseEdgeEditor($is_inverse_edge_editor) {
+ $this->isInverseEdgeEditor = $is_inverse_edge_editor;
+ return $this;
+ }
+
+ public function getIsInverseEdgeEditor() {
+ return $this->isInverseEdgeEditor;
+ }
+
public function setIsHeraldEditor($is_herald_editor) {
$this->isHeraldEditor = $is_herald_editor;
return $this;
@@ -377,10 +387,25 @@
break;
case PhabricatorTransactions::TYPE_EDGE:
+ if ($this->getIsInverseEdgeEditor()) {
+ // If we're writing an inverse edge transaction, don't actually
+ // do anything. The initiating editor on the other side of the
+ // transaction will take care of the edge writes.
+ break;
+ }
+
$old = $xaction->getOldValue();
$new = $xaction->getNewValue();
$src = $object->getPHID();
- $type = $xaction->getMetadataValue('edge:type');
+ $const = $xaction->getMetadataValue('edge:type');
+
+ $type = PhabricatorEdgeType::getByConst($const);
+ if ($type->shouldWriteInverseTransactions()) {
+ $this->applyInverseEdgeTransactions(
+ $object,
+ $xaction,
+ $type->getInverseEdgeConstant());
+ }
foreach ($new as $dst_phid => $edge) {
$new[$dst_phid]['src'] = $src;
@@ -395,7 +420,7 @@
continue;
}
}
- $editor->removeEdge($src, $type, $dst_phid);
+ $editor->removeEdge($src, $const, $dst_phid);
}
foreach ($new as $dst_phid => $edge) {
@@ -409,7 +434,7 @@
'data' => $edge['data'],
);
- $editor->addEdge($src, $type, $dst_phid, $data);
+ $editor->addEdge($src, $const, $dst_phid, $data);
}
$editor->save();
@@ -2335,4 +2360,59 @@
$editor->save();
}
+ private function applyInverseEdgeTransactions(
+ PhabricatorLiskDAO $object,
+ PhabricatorApplicationTransaction $xaction,
+ $inverse_type) {
+
+ $old = $xaction->getOldValue();
+ $new = $xaction->getNewValue();
+
+ $add = array_keys(array_diff_key($new, $old));
+ $rem = array_keys(array_diff_key($old, $new));
+
+ $add = array_fuse($add);
+ $rem = array_fuse($rem);
+ $all = $add + $rem;
+
+ $nodes = id(new PhabricatorObjectQuery())
+ ->setViewer($this->requireActor())
+ ->withPHIDs($all)
+ ->execute();
+
+ foreach ($nodes as $node) {
+ if (!($node instanceof PhabricatorApplicationTransactionInterface)) {
+ continue;
+ }
+
+ $editor = $node->getApplicationTransactionEditor();
+ $template = $node->getApplicationTransactionTemplate();
+ $target = $node->getApplicationTransactionObject();
+
+ if (isset($add[$node->getPHID()])) {
+ $edge_edit_type = '+';
+ } else {
+ $edge_edit_type = '-';
+ }
+
+ $template
+ ->setTransactionType($xaction->getTransactionType())
+ ->setMetadataValue('edge:type', $inverse_type)
+ ->setNewValue(
+ array(
+ $edge_edit_type => array($object->getPHID() => $object->getPHID()),
+ ));
+
+ $editor
+ ->setContinueOnNoEffect(true)
+ ->setContinueOnMissingFields(true)
+ ->setParentMessageID($this->getParentMessageID())
+ ->setIsInverseEdgeEditor(true)
+ ->setActor($this->requireActor())
+ ->setContentSource($this->getContentSource());
+
+ $editor->applyTransactions($target, array($template));
+ }
+ }
+
}
diff --git a/src/infrastructure/edges/constants/PhabricatorEdgeConfig.php b/src/infrastructure/edges/constants/PhabricatorEdgeConfig.php
--- a/src/infrastructure/edges/constants/PhabricatorEdgeConfig.php
+++ b/src/infrastructure/edges/constants/PhabricatorEdgeConfig.php
@@ -19,9 +19,6 @@
const TYPE_BLOG_HAS_BLOGGER = 9;
const TYPE_BLOGGER_HAS_BLOG = 10;
- const TYPE_TASK_HAS_RELATED_DREV = 11;
- const TYPE_DREV_HAS_RELATED_TASK = 12;
-
const TYPE_PROJ_MEMBER = 13;
const TYPE_MEMBER_OF_PROJ = 14;
@@ -124,7 +121,7 @@
return $map;
}
- public static function getInverse($edge_type) {
+ private static function getInverse($edge_type) {
static $map = array(
self::TYPE_TASK_HAS_COMMIT => self::TYPE_COMMIT_HAS_TASK,
self::TYPE_COMMIT_HAS_TASK => self::TYPE_TASK_HAS_COMMIT,
@@ -140,9 +137,6 @@
self::TYPE_BLOG_HAS_BLOGGER => self::TYPE_BLOGGER_HAS_BLOG,
self::TYPE_BLOGGER_HAS_BLOG => self::TYPE_BLOG_HAS_BLOGGER,
- self::TYPE_TASK_HAS_RELATED_DREV => self::TYPE_DREV_HAS_RELATED_TASK,
- self::TYPE_DREV_HAS_RELATED_TASK => self::TYPE_TASK_HAS_RELATED_DREV,
-
self::TYPE_PROJ_MEMBER => self::TYPE_MEMBER_OF_PROJ,
self::TYPE_MEMBER_OF_PROJ => self::TYPE_PROJ_MEMBER,
@@ -213,7 +207,7 @@
return idx($map, $edge_type);
}
- public static function shouldPreventCycles($edge_type) {
+ private static function shouldPreventCycles($edge_type) {
static $map = array(
self::TYPE_TEST_NO_CYCLE => true,
self::TYPE_TASK_DEPENDS_ON_TASK => true,
@@ -259,12 +253,10 @@
case self::TYPE_COMMIT_HAS_TASK:
case self::TYPE_TASK_DEPENDS_ON_TASK:
case self::TYPE_TASK_DEPENDED_ON_BY_TASK:
- case self::TYPE_DREV_HAS_RELATED_TASK:
case self::TYPE_MOCK_HAS_TASK:
return '%s edited task(s), added %d: %s; removed %d: %s.';
case self::TYPE_DREV_DEPENDS_ON_DREV:
case self::TYPE_DREV_DEPENDED_ON_BY_DREV:
- case self::TYPE_TASK_HAS_RELATED_DREV:
case self::TYPE_COMMIT_HAS_DREV:
case self::TYPE_REVIEWER_FOR_DREV:
return '%s edited revision(s), added %d: %s; removed %d: %s.';
@@ -341,11 +333,9 @@
case self::TYPE_TASK_DEPENDED_ON_BY_TASK:
return '%s added %d blocked task(s): %s.';
case self::TYPE_COMMIT_HAS_TASK:
- case self::TYPE_DREV_HAS_RELATED_TASK:
case self::TYPE_MOCK_HAS_TASK:
return '%s added %d task(s): %s.';
case self::TYPE_DREV_DEPENDED_ON_BY_DREV:
- case self::TYPE_TASK_HAS_RELATED_DREV:
case self::TYPE_COMMIT_HAS_DREV:
case self::TYPE_REVIEWER_FOR_DREV:
return '%s added %d revision(s): %s.';
@@ -419,12 +409,10 @@
case self::TYPE_TASK_DEPENDED_ON_BY_TASK:
return '%s removed %d blocked task(s): %s.';
case self::TYPE_COMMIT_HAS_TASK:
- case self::TYPE_DREV_HAS_RELATED_TASK:
case self::TYPE_MOCK_HAS_TASK:
return '%s removed %d task(s): %s.';
case self::TYPE_DREV_DEPENDS_ON_DREV:
case self::TYPE_DREV_DEPENDED_ON_BY_DREV:
- case self::TYPE_TASK_HAS_RELATED_DREV:
case self::TYPE_COMMIT_HAS_DREV:
case self::TYPE_REVIEWER_FOR_DREV:
return '%s removed %d revision(s): %s.';
@@ -494,12 +482,10 @@
case self::TYPE_COMMIT_HAS_TASK:
case self::TYPE_TASK_DEPENDS_ON_TASK:
case self::TYPE_TASK_DEPENDED_ON_BY_TASK:
- case self::TYPE_DREV_HAS_RELATED_TASK:
case self::TYPE_MOCK_HAS_TASK:
return '%s updated tasks of %s.';
case self::TYPE_DREV_DEPENDS_ON_DREV:
case self::TYPE_DREV_DEPENDED_ON_BY_DREV:
- case self::TYPE_TASK_HAS_RELATED_DREV:
case self::TYPE_COMMIT_HAS_DREV:
case self::TYPE_REVIEWER_FOR_DREV:
return '%s updated revisions of %s.';
diff --git a/src/infrastructure/edges/constants/PhabricatorEdgeType.php b/src/infrastructure/edges/constants/PhabricatorEdgeType.php
--- a/src/infrastructure/edges/constants/PhabricatorEdgeType.php
+++ b/src/infrastructure/edges/constants/PhabricatorEdgeType.php
@@ -21,6 +21,10 @@
return false;
}
+ public function shouldWriteInverseTransactions() {
+ return false;
+ }
+
public function getTransactionAddString(
$actor,
$add_count,
diff --git a/src/infrastructure/edges/constants/PhabricatorLegacyEdgeType.php b/src/infrastructure/edges/constants/PhabricatorLegacyEdgeType.php
--- a/src/infrastructure/edges/constants/PhabricatorLegacyEdgeType.php
+++ b/src/infrastructure/edges/constants/PhabricatorLegacyEdgeType.php
@@ -21,7 +21,7 @@
return $this->inverseEdgeConstant;
}
- public function getShouldPreventCycles() {
+ public function shouldPreventCycles() {
return $this->shouldPreventCycles;
}
diff --git a/src/infrastructure/edges/editor/PhabricatorEdgeEditor.php b/src/infrastructure/edges/editor/PhabricatorEdgeEditor.php
--- a/src/infrastructure/edges/editor/PhabricatorEdgeEditor.php
+++ b/src/infrastructure/edges/editor/PhabricatorEdgeEditor.php
@@ -180,8 +180,9 @@
'data' => $data,
);
- $inverse = PhabricatorEdgeConfig::getInverse($type);
- if ($inverse) {
+ $type_obj = PhabricatorEdgeType::getByConst($type);
+ $inverse = $type_obj->getInverseEdgeConstant();
+ if ($inverse !== null) {
// If `inverse_data` is set, overwrite the edge data. Normally, just
// write the same data to the inverse edge.
@@ -398,7 +399,8 @@
$edge_types[$edge['type']] = true;
}
foreach ($edge_types as $type => $ignored) {
- if (!PhabricatorEdgeConfig::shouldPreventCycles($type)) {
+ $type_obj = PhabricatorEdgeType::getByConst($type);
+ if (!$type_obj->shouldPreventCycles()) {
unset($edge_types[$type]);
}
}

File Metadata

Mime Type
text/plain
Expires
Sun, Oct 20, 9:32 PM (1 w, 2 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6723850
Default Alt Text
D9839.id23603.diff (22 KB)

Event Timeline