mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-28 16:30:59 +01:00
Migrate Project edges to subclass PhabricatorEdgeType
Summary: Modernize Project edges to subclass `PhabricatorEdgeType`. Largely based on D11045. Test Plan: Add a member to a project, saw new rows in the `phabricator_project.edge` and `phabricator_user.edge` tables. Reviewers: epriestley, #blessed_reviewers Reviewed By: epriestley, #blessed_reviewers Subscribers: Korvin, epriestley Differential Revision: https://secure.phabricator.com/D11111
This commit is contained in:
parent
422b2f2b89
commit
f0db6e4818
17 changed files with 238 additions and 57 deletions
|
@ -1,6 +1,6 @@
|
||||||
/* These are here so `grep` will find them if we ever change things: */
|
/* These are here so `grep` will find them if we ever change things: */
|
||||||
|
|
||||||
/* PhabricatorEdgeConfig::TYPE_PROJ_MEMBER = 13 */
|
/* PhabricatorProjectProjectHasMemberEdgeType::EDGECONST = 13 */
|
||||||
/* PhabricatorEdgeConfig::TYPE_OBJECT_HAS_SUBSCRIBER = 21 */
|
/* PhabricatorEdgeConfig::TYPE_OBJECT_HAS_SUBSCRIBER = 21 */
|
||||||
|
|
||||||
INSERT IGNORE INTO {$NAMESPACE}_project.edge (src, type, dst, dateCreated)
|
INSERT IGNORE INTO {$NAMESPACE}_project.edge (src, type, dst, dateCreated)
|
||||||
|
|
|
@ -9,7 +9,7 @@ foreach (new LiskMigrationIterator($table) as $project) {
|
||||||
|
|
||||||
$members = PhabricatorEdgeQuery::loadDestinationPHIDs(
|
$members = PhabricatorEdgeQuery::loadDestinationPHIDs(
|
||||||
$project->getPHID(),
|
$project->getPHID(),
|
||||||
PhabricatorEdgeConfig::TYPE_PROJ_MEMBER);
|
PhabricatorProjectProjectHasMemberEdgeType::EDGECONST);
|
||||||
|
|
||||||
if (count($members)) {
|
if (count($members)) {
|
||||||
echo sprintf(
|
echo sprintf(
|
||||||
|
|
|
@ -25,7 +25,7 @@ foreach (new LiskMigrationIterator($table) as $proj) {
|
||||||
foreach ($members as $user_phid) {
|
foreach ($members as $user_phid) {
|
||||||
$editor->addEdge(
|
$editor->addEdge(
|
||||||
$proj->getPHID(),
|
$proj->getPHID(),
|
||||||
PhabricatorEdgeConfig::TYPE_PROJ_MEMBER,
|
PhabricatorProjectProjectHasMemberEdgeType::EDGECONST,
|
||||||
$user_phid);
|
$user_phid);
|
||||||
}
|
}
|
||||||
$editor->save();
|
$editor->save();
|
||||||
|
|
|
@ -2155,6 +2155,7 @@ phutil_register_library_map(array(
|
||||||
'PhabricatorProjectIcon' => 'applications/project/icon/PhabricatorProjectIcon.php',
|
'PhabricatorProjectIcon' => 'applications/project/icon/PhabricatorProjectIcon.php',
|
||||||
'PhabricatorProjectInterface' => 'applications/project/interface/PhabricatorProjectInterface.php',
|
'PhabricatorProjectInterface' => 'applications/project/interface/PhabricatorProjectInterface.php',
|
||||||
'PhabricatorProjectListController' => 'applications/project/controller/PhabricatorProjectListController.php',
|
'PhabricatorProjectListController' => 'applications/project/controller/PhabricatorProjectListController.php',
|
||||||
|
'PhabricatorProjectMemberOfProjectEdgeType' => 'applications/project/edge/PhabricatorProjectMemberOfProjectEdgeType.php',
|
||||||
'PhabricatorProjectMembersEditController' => 'applications/project/controller/PhabricatorProjectMembersEditController.php',
|
'PhabricatorProjectMembersEditController' => 'applications/project/controller/PhabricatorProjectMembersEditController.php',
|
||||||
'PhabricatorProjectMembersRemoveController' => 'applications/project/controller/PhabricatorProjectMembersRemoveController.php',
|
'PhabricatorProjectMembersRemoveController' => 'applications/project/controller/PhabricatorProjectMembersRemoveController.php',
|
||||||
'PhabricatorProjectMoveController' => 'applications/project/controller/PhabricatorProjectMoveController.php',
|
'PhabricatorProjectMoveController' => 'applications/project/controller/PhabricatorProjectMoveController.php',
|
||||||
|
@ -2162,6 +2163,7 @@ phutil_register_library_map(array(
|
||||||
'PhabricatorProjectObjectHasProjectEdgeType' => 'applications/project/edge/PhabricatorProjectObjectHasProjectEdgeType.php',
|
'PhabricatorProjectObjectHasProjectEdgeType' => 'applications/project/edge/PhabricatorProjectObjectHasProjectEdgeType.php',
|
||||||
'PhabricatorProjectOrUserDatasource' => 'applications/project/typeahead/PhabricatorProjectOrUserDatasource.php',
|
'PhabricatorProjectOrUserDatasource' => 'applications/project/typeahead/PhabricatorProjectOrUserDatasource.php',
|
||||||
'PhabricatorProjectProfileController' => 'applications/project/controller/PhabricatorProjectProfileController.php',
|
'PhabricatorProjectProfileController' => 'applications/project/controller/PhabricatorProjectProfileController.php',
|
||||||
|
'PhabricatorProjectProjectHasMemberEdgeType' => 'applications/project/edge/PhabricatorProjectProjectHasMemberEdgeType.php',
|
||||||
'PhabricatorProjectProjectHasObjectEdgeType' => 'applications/project/edge/PhabricatorProjectProjectHasObjectEdgeType.php',
|
'PhabricatorProjectProjectHasObjectEdgeType' => 'applications/project/edge/PhabricatorProjectProjectHasObjectEdgeType.php',
|
||||||
'PhabricatorProjectProjectPHIDType' => 'applications/project/phid/PhabricatorProjectProjectPHIDType.php',
|
'PhabricatorProjectProjectPHIDType' => 'applications/project/phid/PhabricatorProjectProjectPHIDType.php',
|
||||||
'PhabricatorProjectQuery' => 'applications/project/query/PhabricatorProjectQuery.php',
|
'PhabricatorProjectQuery' => 'applications/project/query/PhabricatorProjectQuery.php',
|
||||||
|
@ -5350,6 +5352,7 @@ phutil_register_library_map(array(
|
||||||
'PhabricatorProjectEditorTestCase' => 'PhabricatorTestCase',
|
'PhabricatorProjectEditorTestCase' => 'PhabricatorTestCase',
|
||||||
'PhabricatorProjectIcon' => 'Phobject',
|
'PhabricatorProjectIcon' => 'Phobject',
|
||||||
'PhabricatorProjectListController' => 'PhabricatorProjectController',
|
'PhabricatorProjectListController' => 'PhabricatorProjectController',
|
||||||
|
'PhabricatorProjectMemberOfProjectEdgeType' => 'PhabricatorEdgeType',
|
||||||
'PhabricatorProjectMembersEditController' => 'PhabricatorProjectController',
|
'PhabricatorProjectMembersEditController' => 'PhabricatorProjectController',
|
||||||
'PhabricatorProjectMembersRemoveController' => 'PhabricatorProjectController',
|
'PhabricatorProjectMembersRemoveController' => 'PhabricatorProjectController',
|
||||||
'PhabricatorProjectMoveController' => 'PhabricatorProjectController',
|
'PhabricatorProjectMoveController' => 'PhabricatorProjectController',
|
||||||
|
@ -5357,6 +5360,7 @@ phutil_register_library_map(array(
|
||||||
'PhabricatorProjectObjectHasProjectEdgeType' => 'PhabricatorEdgeType',
|
'PhabricatorProjectObjectHasProjectEdgeType' => 'PhabricatorEdgeType',
|
||||||
'PhabricatorProjectOrUserDatasource' => 'PhabricatorTypeaheadCompositeDatasource',
|
'PhabricatorProjectOrUserDatasource' => 'PhabricatorTypeaheadCompositeDatasource',
|
||||||
'PhabricatorProjectProfileController' => 'PhabricatorProjectController',
|
'PhabricatorProjectProfileController' => 'PhabricatorProjectController',
|
||||||
|
'PhabricatorProjectProjectHasMemberEdgeType' => 'PhabricatorEdgeType',
|
||||||
'PhabricatorProjectProjectHasObjectEdgeType' => 'PhabricatorEdgeType',
|
'PhabricatorProjectProjectHasObjectEdgeType' => 'PhabricatorEdgeType',
|
||||||
'PhabricatorProjectProjectPHIDType' => 'PhabricatorPHIDType',
|
'PhabricatorProjectProjectPHIDType' => 'PhabricatorPHIDType',
|
||||||
'PhabricatorProjectQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
|
'PhabricatorProjectQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
|
||||||
|
|
|
@ -57,7 +57,9 @@ final class PhabricatorOwnersOwner extends PhabricatorOwnersDAO {
|
||||||
if ($project_phids) {
|
if ($project_phids) {
|
||||||
$query = id(new PhabricatorEdgeQuery())
|
$query = id(new PhabricatorEdgeQuery())
|
||||||
->withSourcePHIDs($project_phids)
|
->withSourcePHIDs($project_phids)
|
||||||
->withEdgeTypes(array(PhabricatorEdgeConfig::TYPE_PROJ_MEMBER));
|
->withEdgeTypes(array(
|
||||||
|
PhabricatorProjectProjectHasMemberEdgeType::EDGECONST,
|
||||||
|
));
|
||||||
$query->execute();
|
$query->execute();
|
||||||
$users_in_project_phids = $query->getDestinationPHIDs();
|
$users_in_project_phids = $query->getDestinationPHIDs();
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,9 @@ final class ProjectCreateConduitAPIMethod extends ProjectConduitAPIMethod {
|
||||||
|
|
||||||
$xactions[] = id(new PhabricatorProjectTransaction())
|
$xactions[] = id(new PhabricatorProjectTransaction())
|
||||||
->setTransactionType(PhabricatorTransactions::TYPE_EDGE)
|
->setTransactionType(PhabricatorTransactions::TYPE_EDGE)
|
||||||
->setMetadataValue('edge:type', PhabricatorEdgeConfig::TYPE_PROJ_MEMBER)
|
->setMetadataValue(
|
||||||
|
'edge:type',
|
||||||
|
PhabricatorProjectProjectHasMemberEdgeType::EDGECONST)
|
||||||
->setNewValue(
|
->setNewValue(
|
||||||
array(
|
array(
|
||||||
'+' => array_fuse($members),
|
'+' => array_fuse($members),
|
||||||
|
|
|
@ -128,7 +128,7 @@ final class PhabricatorProjectEditDetailsController
|
||||||
->setTransactionType(PhabricatorTransactions::TYPE_EDGE)
|
->setTransactionType(PhabricatorTransactions::TYPE_EDGE)
|
||||||
->setMetadataValue(
|
->setMetadataValue(
|
||||||
'edge:type',
|
'edge:type',
|
||||||
PhabricatorEdgeConfig::TYPE_PROJ_MEMBER)
|
PhabricatorProjectProjectHasMemberEdgeType::EDGECONST)
|
||||||
->setNewValue(
|
->setNewValue(
|
||||||
array(
|
array(
|
||||||
'+' => array($viewer->getPHID() => $viewer->getPHID()),
|
'+' => array($viewer->getPHID() => $viewer->getPHID()),
|
||||||
|
|
|
@ -42,7 +42,7 @@ final class PhabricatorProjectMembersEditController
|
||||||
$member_spec['+'] = array_fuse($add_members);
|
$member_spec['+'] = array_fuse($add_members);
|
||||||
}
|
}
|
||||||
|
|
||||||
$type_member = PhabricatorEdgeConfig::TYPE_PROJ_MEMBER;
|
$type_member = PhabricatorProjectProjectHasMemberEdgeType::EDGECONST;
|
||||||
|
|
||||||
$xactions = array();
|
$xactions = array();
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ final class PhabricatorProjectMembersRemoveController
|
||||||
$member_spec = array();
|
$member_spec = array();
|
||||||
$member_spec['-'] = array($remove_phid => $remove_phid);
|
$member_spec['-'] = array($remove_phid => $remove_phid);
|
||||||
|
|
||||||
$type_member = PhabricatorEdgeConfig::TYPE_PROJ_MEMBER;
|
$type_member = PhabricatorProjectProjectHasMemberEdgeType::EDGECONST;
|
||||||
|
|
||||||
$xactions = array();
|
$xactions = array();
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,7 @@ final class PhabricatorProjectUpdateController
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
$type_member = PhabricatorEdgeConfig::TYPE_PROJ_MEMBER;
|
$type_member = PhabricatorProjectProjectHasMemberEdgeType::EDGECONST;
|
||||||
$member_spec = array(
|
$member_spec = array(
|
||||||
$edge_action => array($user->getPHID() => $user->getPHID()),
|
$edge_action => array($user->getPHID() => $user->getPHID()),
|
||||||
);
|
);
|
||||||
|
|
|
@ -0,0 +1,103 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
final class PhabricatorProjectMemberOfProjectEdgeType
|
||||||
|
extends PhabricatorEdgeType {
|
||||||
|
|
||||||
|
const EDGECONST = 14;
|
||||||
|
|
||||||
|
public function getInverseEdgeConstant() {
|
||||||
|
return PhabricatorProjectProjectHasMemberEdgeType::EDGECONST;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function shouldWriteInverseTransactions() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getTransactionAddString(
|
||||||
|
$actor,
|
||||||
|
$add_count,
|
||||||
|
$add_edges) {
|
||||||
|
|
||||||
|
return pht(
|
||||||
|
'%s added %s project(s): %s.',
|
||||||
|
$actor,
|
||||||
|
$add_count,
|
||||||
|
$add_edges);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getTransactionRemoveString(
|
||||||
|
$actor,
|
||||||
|
$rem_count,
|
||||||
|
$rem_edges) {
|
||||||
|
|
||||||
|
return pht(
|
||||||
|
'%s removed %s project(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 project(s), added %s: %s; removed %s: %s.',
|
||||||
|
$actor,
|
||||||
|
$add_count,
|
||||||
|
$add_edges,
|
||||||
|
$rem_count,
|
||||||
|
$rem_edges);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getFeedAddString(
|
||||||
|
$actor,
|
||||||
|
$object,
|
||||||
|
$add_count,
|
||||||
|
$add_edges) {
|
||||||
|
|
||||||
|
return pht(
|
||||||
|
'%s added %s project(s) for %s: %s.',
|
||||||
|
$actor,
|
||||||
|
$add_count,
|
||||||
|
$object,
|
||||||
|
$add_edges);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getFeedRemoveString(
|
||||||
|
$actor,
|
||||||
|
$object,
|
||||||
|
$rem_count,
|
||||||
|
$rem_edges) {
|
||||||
|
|
||||||
|
return pht(
|
||||||
|
'%s removed %s project(s) for %s: %s.',
|
||||||
|
$actor,
|
||||||
|
$rem_count,
|
||||||
|
$object,
|
||||||
|
$rem_edges);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getFeedEditString(
|
||||||
|
$actor,
|
||||||
|
$object,
|
||||||
|
$total_count,
|
||||||
|
$add_count,
|
||||||
|
$add_edges,
|
||||||
|
$rem_count,
|
||||||
|
$rem_edges) {
|
||||||
|
|
||||||
|
return pht(
|
||||||
|
'%s edited project(s) for %s, added %s: %s; removed %s: %s.',
|
||||||
|
$actor,
|
||||||
|
$object,
|
||||||
|
$add_count,
|
||||||
|
$add_edges,
|
||||||
|
$rem_count,
|
||||||
|
$rem_edges);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,103 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
final class PhabricatorProjectProjectHasMemberEdgeType
|
||||||
|
extends PhabricatorEdgeType {
|
||||||
|
|
||||||
|
const EDGECONST = 13;
|
||||||
|
|
||||||
|
public function getInverseEdgeConstant() {
|
||||||
|
return PhabricatorProjectMemberOfProjectEdgeType::EDGECONST;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function shouldWriteInverseTransactions() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getTransactionAddString(
|
||||||
|
$actor,
|
||||||
|
$add_count,
|
||||||
|
$add_edges) {
|
||||||
|
|
||||||
|
return pht(
|
||||||
|
'%s added %s member(s): %s.',
|
||||||
|
$actor,
|
||||||
|
$add_count,
|
||||||
|
$add_edges);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getTransactionRemoveString(
|
||||||
|
$actor,
|
||||||
|
$rem_count,
|
||||||
|
$rem_edges) {
|
||||||
|
|
||||||
|
return pht(
|
||||||
|
'%s removed %s member(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 member(s), added %s: %s; removed %s: %s.',
|
||||||
|
$actor,
|
||||||
|
$add_count,
|
||||||
|
$add_edges,
|
||||||
|
$rem_count,
|
||||||
|
$rem_edges);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getFeedAddString(
|
||||||
|
$actor,
|
||||||
|
$object,
|
||||||
|
$add_count,
|
||||||
|
$add_edges) {
|
||||||
|
|
||||||
|
return pht(
|
||||||
|
'%s added %s member(s) for %s: %s.',
|
||||||
|
$actor,
|
||||||
|
$add_count,
|
||||||
|
$object,
|
||||||
|
$add_edges);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getFeedRemoveString(
|
||||||
|
$actor,
|
||||||
|
$object,
|
||||||
|
$rem_count,
|
||||||
|
$rem_edges) {
|
||||||
|
|
||||||
|
return pht(
|
||||||
|
'%s removed %s member(s) for %s: %s.',
|
||||||
|
$actor,
|
||||||
|
$rem_count,
|
||||||
|
$object,
|
||||||
|
$rem_edges);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getFeedEditString(
|
||||||
|
$actor,
|
||||||
|
$object,
|
||||||
|
$total_count,
|
||||||
|
$add_count,
|
||||||
|
$add_edges,
|
||||||
|
$rem_count,
|
||||||
|
$rem_edges) {
|
||||||
|
|
||||||
|
return pht(
|
||||||
|
'%s edited member(s) for %s, added %s: %s; removed %s: %s.',
|
||||||
|
$actor,
|
||||||
|
$object,
|
||||||
|
$add_count,
|
||||||
|
$add_edges,
|
||||||
|
$rem_count,
|
||||||
|
$rem_edges);
|
||||||
|
}
|
||||||
|
}
|
|
@ -179,7 +179,7 @@ final class PhabricatorProjectTransactionEditor
|
||||||
case PhabricatorTransactions::TYPE_EDGE:
|
case PhabricatorTransactions::TYPE_EDGE:
|
||||||
$edge_type = $xaction->getMetadataValue('edge:type');
|
$edge_type = $xaction->getMetadataValue('edge:type');
|
||||||
switch ($edge_type) {
|
switch ($edge_type) {
|
||||||
case PhabricatorEdgeConfig::TYPE_PROJ_MEMBER:
|
case PhabricatorProjectProjectHasMemberEdgeType::EDGECONST:
|
||||||
case PhabricatorEdgeConfig::TYPE_OBJECT_HAS_WATCHER:
|
case PhabricatorEdgeConfig::TYPE_OBJECT_HAS_WATCHER:
|
||||||
$old = $xaction->getOldValue();
|
$old = $xaction->getOldValue();
|
||||||
$new = $xaction->getNewValue();
|
$new = $xaction->getNewValue();
|
||||||
|
@ -190,7 +190,8 @@ final class PhabricatorProjectTransactionEditor
|
||||||
// When removing members, we remove their subscription too.
|
// When removing members, we remove their subscription too.
|
||||||
// When unwatching, we leave subscriptions, since it's fine to be
|
// When unwatching, we leave subscriptions, since it's fine to be
|
||||||
// subscribed to a project but not be a member of it.
|
// subscribed to a project but not be a member of it.
|
||||||
if ($edge_type == PhabricatorEdgeConfig::TYPE_PROJ_MEMBER) {
|
$edge_const = PhabricatorProjectProjectHasMemberEdgeType::EDGECONST;
|
||||||
|
if ($edge_type == $edge_const) {
|
||||||
$rem = array_keys(array_diff_key($old, $new));
|
$rem = array_keys(array_diff_key($old, $new));
|
||||||
} else {
|
} else {
|
||||||
$rem = array();
|
$rem = array();
|
||||||
|
@ -366,7 +367,7 @@ final class PhabricatorProjectTransactionEditor
|
||||||
return;
|
return;
|
||||||
case PhabricatorTransactions::TYPE_EDGE:
|
case PhabricatorTransactions::TYPE_EDGE:
|
||||||
switch ($xaction->getMetadataValue('edge:type')) {
|
switch ($xaction->getMetadataValue('edge:type')) {
|
||||||
case PhabricatorEdgeConfig::TYPE_PROJ_MEMBER:
|
case PhabricatorProjectProjectHasMemberEdgeType::EDGECONST:
|
||||||
$old = $xaction->getOldValue();
|
$old = $xaction->getOldValue();
|
||||||
$new = $xaction->getNewValue();
|
$new = $xaction->getNewValue();
|
||||||
|
|
||||||
|
|
|
@ -274,7 +274,9 @@ final class PhabricatorProjectEditorTestCase extends PhabricatorTestCase {
|
||||||
$xactions = array();
|
$xactions = array();
|
||||||
$xactions[] = id(new PhabricatorProjectTransaction())
|
$xactions[] = id(new PhabricatorProjectTransaction())
|
||||||
->setTransactionType(PhabricatorTransactions::TYPE_EDGE)
|
->setTransactionType(PhabricatorTransactions::TYPE_EDGE)
|
||||||
->setMetadataValue('edge:type', PhabricatorEdgeConfig::TYPE_PROJ_MEMBER)
|
->setMetadataValue(
|
||||||
|
'edge:type',
|
||||||
|
PhabricatorProjectProjectHasMemberEdgeType::EDGECONST)
|
||||||
->setNewValue($spec);
|
->setNewValue($spec);
|
||||||
|
|
||||||
$editor = id(new PhabricatorProjectTransactionEditor())
|
$editor = id(new PhabricatorProjectTransactionEditor())
|
||||||
|
|
|
@ -138,7 +138,7 @@ final class PhabricatorProjectQuery
|
||||||
$viewer_phid = $this->getViewer()->getPHID();
|
$viewer_phid = $this->getViewer()->getPHID();
|
||||||
$project_phids = mpull($projects, 'getPHID');
|
$project_phids = mpull($projects, 'getPHID');
|
||||||
|
|
||||||
$member_type = PhabricatorEdgeConfig::TYPE_PROJ_MEMBER;
|
$member_type = PhabricatorProjectProjectHasMemberEdgeType::EDGECONST;
|
||||||
$watcher_type = PhabricatorEdgeConfig::TYPE_OBJECT_HAS_WATCHER;
|
$watcher_type = PhabricatorEdgeConfig::TYPE_OBJECT_HAS_WATCHER;
|
||||||
|
|
||||||
$need_edge_types = array();
|
$need_edge_types = array();
|
||||||
|
@ -338,7 +338,7 @@ final class PhabricatorProjectQuery
|
||||||
$conn_r,
|
$conn_r,
|
||||||
'LEFT JOIN %T vm ON vm.src = p.phid AND vm.type = %d AND vm.dst = %s',
|
'LEFT JOIN %T vm ON vm.src = p.phid AND vm.type = %d AND vm.dst = %s',
|
||||||
PhabricatorEdgeConfig::TABLE_NAME_EDGE,
|
PhabricatorEdgeConfig::TABLE_NAME_EDGE,
|
||||||
PhabricatorEdgeConfig::TYPE_PROJ_MEMBER,
|
PhabricatorProjectProjectHasMemberEdgeType::EDGECONST,
|
||||||
$this->getViewer()->getPHID());
|
$this->getViewer()->getPHID());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -347,7 +347,7 @@ final class PhabricatorProjectQuery
|
||||||
$conn_r,
|
$conn_r,
|
||||||
'JOIN %T e ON e.src = p.phid AND e.type = %d',
|
'JOIN %T e ON e.src = p.phid AND e.type = %d',
|
||||||
PhabricatorEdgeConfig::TABLE_NAME_EDGE,
|
PhabricatorEdgeConfig::TABLE_NAME_EDGE,
|
||||||
PhabricatorEdgeConfig::TYPE_PROJ_MEMBER);
|
PhabricatorProjectProjectHasMemberEdgeType::EDGECONST);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->slugs !== null) {
|
if ($this->slugs !== null) {
|
||||||
|
|
|
@ -5,9 +5,6 @@ final class PhabricatorEdgeConfig extends PhabricatorEdgeConstants {
|
||||||
const TABLE_NAME_EDGE = 'edge';
|
const TABLE_NAME_EDGE = 'edge';
|
||||||
const TABLE_NAME_EDGEDATA = 'edgedata';
|
const TABLE_NAME_EDGEDATA = 'edgedata';
|
||||||
|
|
||||||
const TYPE_PROJ_MEMBER = 13;
|
|
||||||
const TYPE_MEMBER_OF_PROJ = 14;
|
|
||||||
|
|
||||||
const TYPE_OBJECT_HAS_SUBSCRIBER = 21;
|
const TYPE_OBJECT_HAS_SUBSCRIBER = 21;
|
||||||
const TYPE_SUBSCRIBED_TO_OBJECT = 22;
|
const TYPE_SUBSCRIBED_TO_OBJECT = 22;
|
||||||
|
|
||||||
|
@ -103,9 +100,6 @@ final class PhabricatorEdgeConfig extends PhabricatorEdgeConstants {
|
||||||
|
|
||||||
private static function getInverse($edge_type) {
|
private static function getInverse($edge_type) {
|
||||||
static $map = array(
|
static $map = array(
|
||||||
self::TYPE_PROJ_MEMBER => self::TYPE_MEMBER_OF_PROJ,
|
|
||||||
self::TYPE_MEMBER_OF_PROJ => self::TYPE_PROJ_MEMBER,
|
|
||||||
|
|
||||||
self::TYPE_OBJECT_HAS_SUBSCRIBER => self::TYPE_SUBSCRIBED_TO_OBJECT,
|
self::TYPE_OBJECT_HAS_SUBSCRIBER => self::TYPE_SUBSCRIBED_TO_OBJECT,
|
||||||
self::TYPE_SUBSCRIBED_TO_OBJECT => self::TYPE_OBJECT_HAS_SUBSCRIBER,
|
self::TYPE_SUBSCRIBED_TO_OBJECT => self::TYPE_OBJECT_HAS_SUBSCRIBER,
|
||||||
|
|
||||||
|
@ -179,10 +173,6 @@ final class PhabricatorEdgeConfig extends PhabricatorEdgeConstants {
|
||||||
switch ($type) {
|
switch ($type) {
|
||||||
case self::TYPE_MOCK_HAS_TASK:
|
case self::TYPE_MOCK_HAS_TASK:
|
||||||
return '%s edited task(s), added %d: %s; removed %d: %s.';
|
return '%s edited task(s), added %d: %s; removed %d: %s.';
|
||||||
case self::TYPE_PROJ_MEMBER:
|
|
||||||
return '%s edited member(s), added %d: %s; removed %d: %s.';
|
|
||||||
case self::TYPE_MEMBER_OF_PROJ:
|
|
||||||
return '%s edited project(s), added %d: %s; removed %d: %s.';
|
|
||||||
case self::TYPE_OBJECT_HAS_SUBSCRIBER:
|
case self::TYPE_OBJECT_HAS_SUBSCRIBER:
|
||||||
return '%s edited subscriber(s), added %d: %s; removed %d: %s.';
|
return '%s edited subscriber(s), added %d: %s; removed %d: %s.';
|
||||||
case self::TYPE_SUBSCRIBED_TO_OBJECT:
|
case self::TYPE_SUBSCRIBED_TO_OBJECT:
|
||||||
|
@ -216,10 +206,6 @@ final class PhabricatorEdgeConfig extends PhabricatorEdgeConstants {
|
||||||
switch ($type) {
|
switch ($type) {
|
||||||
case self::TYPE_MOCK_HAS_TASK:
|
case self::TYPE_MOCK_HAS_TASK:
|
||||||
return '%s added %d task(s): %s.';
|
return '%s added %d task(s): %s.';
|
||||||
case self::TYPE_PROJ_MEMBER:
|
|
||||||
return '%s added %d member(s): %s.';
|
|
||||||
case self::TYPE_MEMBER_OF_PROJ:
|
|
||||||
return '%s added %d project(s): %s.';
|
|
||||||
case self::TYPE_OBJECT_HAS_SUBSCRIBER:
|
case self::TYPE_OBJECT_HAS_SUBSCRIBER:
|
||||||
return '%s added %d subscriber(s): %s.';
|
return '%s added %d subscriber(s): %s.';
|
||||||
case self::TYPE_OBJECT_HAS_UNSUBSCRIBER:
|
case self::TYPE_OBJECT_HAS_UNSUBSCRIBER:
|
||||||
|
@ -250,10 +236,6 @@ final class PhabricatorEdgeConfig extends PhabricatorEdgeConstants {
|
||||||
switch ($type) {
|
switch ($type) {
|
||||||
case self::TYPE_MOCK_HAS_TASK:
|
case self::TYPE_MOCK_HAS_TASK:
|
||||||
return '%s removed %d task(s): %s.';
|
return '%s removed %d task(s): %s.';
|
||||||
case self::TYPE_PROJ_MEMBER:
|
|
||||||
return '%s removed %d member(s): %s.';
|
|
||||||
case self::TYPE_MEMBER_OF_PROJ:
|
|
||||||
return '%s removed %d project(s): %s.';
|
|
||||||
case self::TYPE_OBJECT_HAS_SUBSCRIBER:
|
case self::TYPE_OBJECT_HAS_SUBSCRIBER:
|
||||||
return '%s removed %d subscriber(s): %s.';
|
return '%s removed %d subscriber(s): %s.';
|
||||||
case self::TYPE_OBJECT_HAS_UNSUBSCRIBER:
|
case self::TYPE_OBJECT_HAS_UNSUBSCRIBER:
|
||||||
|
@ -284,10 +266,6 @@ final class PhabricatorEdgeConfig extends PhabricatorEdgeConstants {
|
||||||
switch ($type) {
|
switch ($type) {
|
||||||
case self::TYPE_MOCK_HAS_TASK:
|
case self::TYPE_MOCK_HAS_TASK:
|
||||||
return '%s updated tasks of %s.';
|
return '%s updated tasks of %s.';
|
||||||
case self::TYPE_PROJ_MEMBER:
|
|
||||||
return '%s updated members of %s.';
|
|
||||||
case self::TYPE_MEMBER_OF_PROJ:
|
|
||||||
return '%s updated projects of %s.';
|
|
||||||
case self::TYPE_OBJECT_HAS_SUBSCRIBER:
|
case self::TYPE_OBJECT_HAS_SUBSCRIBER:
|
||||||
return '%s updated subscribers of %s.';
|
return '%s updated subscribers of %s.';
|
||||||
case self::TYPE_OBJECT_HAS_UNSUBSCRIBER:
|
case self::TYPE_OBJECT_HAS_UNSUBSCRIBER:
|
||||||
|
|
|
@ -133,31 +133,31 @@ abstract class PhabricatorBaseEnglishTranslation
|
||||||
'%s edited member(s), added %d: %s; removed %d: %s.' =>
|
'%s edited member(s), added %d: %s; removed %d: %s.' =>
|
||||||
'%s edited members, added: %3$s; removed: %5$s.',
|
'%s edited members, added: %3$s; removed: %5$s.',
|
||||||
|
|
||||||
'%s added %d member(s): %s.' => array(
|
'%s added %s member(s): %s.' => array(
|
||||||
array(
|
array(
|
||||||
'%s added a member: %3$s.',
|
'%s added a member: %3$s.',
|
||||||
'%s added members: %3$s.',
|
'%s added members: %3$s.',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
'%s removed %d member(s): %s.' => array(
|
'%s removed %s member(s): %s.' => array(
|
||||||
array(
|
array(
|
||||||
'%s removed a member: %3$s.',
|
'%s removed a member: %3$s.',
|
||||||
'%s removed members: %3$s.',
|
'%s removed members: %3$s.',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
'%s edited project(s), added %d: %s; removed %d: %s.' =>
|
'%s edited project(s), added %s: %s; removed %s: %s.' =>
|
||||||
'%s edited projects, added: %3$s; removed: %5$s.',
|
'%s edited projects, added: %3$s; removed: %5$s.',
|
||||||
|
|
||||||
'%s added %d project(s): %s.' => array(
|
'%s added %s project(s): %s.' => array(
|
||||||
array(
|
array(
|
||||||
'%s added a project: %3$s.',
|
'%s added a project: %3$s.',
|
||||||
'%s added projects: %3$s.',
|
'%s added projects: %3$s.',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
'%s removed %d project(s): %s.' => array(
|
'%s removed %s project(s): %s.' => array(
|
||||||
array(
|
array(
|
||||||
'%s removed a project: %3$s.',
|
'%s removed a project: %3$s.',
|
||||||
'%s removed projects: %3$s.',
|
'%s removed projects: %3$s.',
|
||||||
|
@ -792,20 +792,6 @@ abstract class PhabricatorBaseEnglishTranslation
|
||||||
'%s edited %s revision(s) for %s, added %s: %s; removed %s: %s.' =>
|
'%s edited %s revision(s) for %s, added %s: %s; removed %s: %s.' =>
|
||||||
'%s edited revisions for %3$s, added: %5$s; removed %7$s.',
|
'%s edited revisions for %3$s, added: %5$s; removed %7$s.',
|
||||||
|
|
||||||
'%s added %s project(s): %s.' => array(
|
|
||||||
array(
|
|
||||||
'%s added a project: %3$s.',
|
|
||||||
'%s added projects: %3$s.',
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
'%s removed %s project(s): %s.' => array(
|
|
||||||
array(
|
|
||||||
'%s removed a project: %3$s.',
|
|
||||||
'%s removed projects: %3$s.',
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
'%s edited %s project(s), added %s: %s; removed %s: %s.' =>
|
'%s edited %s project(s), added %s: %s; removed %s: %s.' =>
|
||||||
'%s edited projects, added %4$s; removed %6$s.',
|
'%s edited projects, added %4$s; removed %6$s.',
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue