diff --git a/resources/celerity/map.php b/resources/celerity/map.php index a24a40d9fe..73bb3cab0b 100644 --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -8,7 +8,7 @@ return array( 'names' => array( 'core.pkg.css' => '4e1d9fba', - 'core.pkg.js' => '80884e9b', + 'core.pkg.js' => 'ba6a742f', 'darkconsole.pkg.js' => 'df001cab', 'differential.pkg.css' => '4a93db37', 'differential.pkg.js' => '7528cfc9', @@ -214,7 +214,7 @@ return array( 'rsrc/externals/javelin/lib/__tests__/behavior.js' => '1ea62783', 'rsrc/externals/javelin/lib/behavior.js' => '61cbc29a', 'rsrc/externals/javelin/lib/control/tokenizer/Tokenizer.js' => 'a5b67173', - 'rsrc/externals/javelin/lib/control/typeahead/Typeahead.js' => '61f72a3d', + 'rsrc/externals/javelin/lib/control/typeahead/Typeahead.js' => 'e614d22b', 'rsrc/externals/javelin/lib/control/typeahead/normalizer/TypeaheadNormalizer.js' => 'aa93c7b0', 'rsrc/externals/javelin/lib/control/typeahead/source/TypeaheadCompositeSource.js' => '503e17fd', 'rsrc/externals/javelin/lib/control/typeahead/source/TypeaheadOnDemandSource.js' => '8b3fd187', @@ -394,7 +394,7 @@ return array( 'rsrc/js/application/files/behavior-icon-composer.js' => '8ef9ab58', 'rsrc/js/application/files/behavior-launch-icon-composer.js' => '48086888', 'rsrc/js/application/harbormaster/behavior-reorder-steps.js' => 'b716477f', - 'rsrc/js/application/herald/HeraldRuleEditor.js' => '58e048fc', + 'rsrc/js/application/herald/HeraldRuleEditor.js' => '3fc2c8f2', 'rsrc/js/application/herald/PathTypeahead.js' => 'f7fc67ec', 'rsrc/js/application/herald/herald-rule-editor.js' => '7ebaeed3', 'rsrc/js/application/maniphest/behavior-batch-editor.js' => 'f588412e', @@ -416,7 +416,7 @@ return array( 'rsrc/js/application/phortune/behavior-test-payment-form.js' => 'ab8d2723', 'rsrc/js/application/phortune/phortune-credit-card-form.js' => '2290aeef', 'rsrc/js/application/policy/behavior-policy-control.js' => 'f3fef818', - 'rsrc/js/application/policy/behavior-policy-rule-editor.js' => '92918fcb', + 'rsrc/js/application/policy/behavior-policy-rule-editor.js' => 'fe9a552f', 'rsrc/js/application/ponder/behavior-votebox.js' => '4e9b766b', 'rsrc/js/application/projects/behavior-boards-dropdown.js' => '0ec56e1d', 'rsrc/js/application/projects/behavior-project-boards.js' => 'c6b95cbd', @@ -452,7 +452,7 @@ return array( 'rsrc/js/core/KeyboardShortcutManager.js' => 'ad7a69ca', 'rsrc/js/core/MultirowRowManager.js' => '41e47dea', 'rsrc/js/core/Notification.js' => '0c6946e7', - 'rsrc/js/core/Prefab.js' => '41ed7994', + 'rsrc/js/core/Prefab.js' => 'bbae734c', 'rsrc/js/core/ShapedRequest.js' => '7cbe244b', 'rsrc/js/core/TextAreaUtils.js' => 'b3ec3cfc', 'rsrc/js/core/ToolTip.js' => '3915d490', @@ -487,7 +487,7 @@ return array( 'rsrc/js/core/behavior-remarkup-preview.js' => 'f7379f45', 'rsrc/js/core/behavior-reorder-applications.js' => '76b9fc3e', 'rsrc/js/core/behavior-reveal-content.js' => '60821bc7', - 'rsrc/js/core/behavior-search-typeahead.js' => '5a376f34', + 'rsrc/js/core/behavior-search-typeahead.js' => 'd712ac5f', 'rsrc/js/core/behavior-select-on-click.js' => '4e3e79a6', 'rsrc/js/core/behavior-toggle-class.js' => 'e566f52c', 'rsrc/js/core/behavior-tokenizer.js' => 'b3a4b884', @@ -545,7 +545,7 @@ return array( 'global-drag-and-drop-css' => '697324ad', 'harbormaster-css' => 'cec833b7', 'herald-css' => 'c544dd1c', - 'herald-rule-editor' => '58e048fc', + 'herald-rule-editor' => '3fc2c8f2', 'herald-test-css' => '778b008e', 'inline-comment-summary-css' => '8cfd34e8', 'javelin-aphlict' => '4a07e8e3', @@ -631,7 +631,7 @@ return array( 'javelin-behavior-phabricator-oncopy' => '2926fff2', 'javelin-behavior-phabricator-remarkup-assist' => 'e32d14ab', 'javelin-behavior-phabricator-reveal-content' => '60821bc7', - 'javelin-behavior-phabricator-search-typeahead' => '5a376f34', + 'javelin-behavior-phabricator-search-typeahead' => 'd712ac5f', 'javelin-behavior-phabricator-show-all-transactions' => '7c273581', 'javelin-behavior-phabricator-tooltips' => '3ee3408b', 'javelin-behavior-phabricator-transaction-comment-form' => '9f7309fb', @@ -643,7 +643,7 @@ return array( 'javelin-behavior-phui-object-box-tabs' => 'a3e2244e', 'javelin-behavior-phui-timeline-dropdown-menu' => '4d94d9c3', 'javelin-behavior-policy-control' => 'f3fef818', - 'javelin-behavior-policy-rule-editor' => '92918fcb', + 'javelin-behavior-policy-rule-editor' => 'fe9a552f', 'javelin-behavior-ponder-votebox' => '4e9b766b', 'javelin-behavior-project-boards' => 'c6b95cbd', 'javelin-behavior-project-create' => '065227cc', @@ -685,7 +685,7 @@ return array( 'javelin-router' => '29274e2b', 'javelin-stratcom' => '8b0ad945', 'javelin-tokenizer' => 'a5b67173', - 'javelin-typeahead' => '61f72a3d', + 'javelin-typeahead' => 'e614d22b', 'javelin-typeahead-composite-source' => '503e17fd', 'javelin-typeahead-normalizer' => 'aa93c7b0', 'javelin-typeahead-ondemand-source' => '8b3fd187', @@ -739,7 +739,7 @@ return array( 'phabricator-notification-menu-css' => '8ae4a008', 'phabricator-object-selector-css' => '029a133d', 'phabricator-phtize' => 'd254d646', - 'phabricator-prefab' => '41ed7994', + 'phabricator-prefab' => 'bbae734c', 'phabricator-profile-css' => 'b459416e', 'phabricator-remarkup-css' => 'ad4c0676', 'phabricator-search-results-css' => 'f240504c', @@ -1095,6 +1095,15 @@ return array( 2 => 'javelin-stratcom', 3 => 'phabricator-tooltip', ), + '3fc2c8f2' => array( + 0 => 'multirow-row-manager', + 1 => 'javelin-install', + 2 => 'javelin-util', + 3 => 'javelin-dom', + 4 => 'javelin-stratcom', + 5 => 'javelin-json', + 6 => 'phabricator-prefab', + ), '40a6a403' => array( 0 => 'javelin-install', 1 => 'javelin-dom', @@ -1118,18 +1127,6 @@ return array( 2 => 'javelin-dom', 3 => 'javelin-util', ), - '41ed7994' => array( - 0 => 'javelin-install', - 1 => 'javelin-util', - 2 => 'javelin-dom', - 3 => 'javelin-typeahead', - 4 => 'javelin-tokenizer', - 5 => 'javelin-typeahead-preloaded-source', - 6 => 'javelin-typeahead-ondemand-source', - 7 => 'javelin-dom', - 8 => 'javelin-stratcom', - 9 => 'javelin-util', - ), '44168bad' => array( 0 => 'javelin-behavior', 1 => 'javelin-dom', @@ -1203,15 +1200,6 @@ return array( 2 => 'javelin-vector', 3 => 'javelin-dom', ), - '58e048fc' => array( - 0 => 'multirow-row-manager', - 1 => 'javelin-install', - 2 => 'javelin-util', - 3 => 'javelin-dom', - 4 => 'javelin-stratcom', - 5 => 'javelin-json', - 6 => 'phabricator-prefab', - ), '58f7803f' => array( 0 => 'javelin-behavior', 1 => 'javelin-aphlict', @@ -1224,15 +1212,6 @@ return array( 2 => 'javelin-vector', 3 => 'javelin-dom', ), - '5a376f34' => array( - 0 => 'javelin-behavior', - 1 => 'javelin-typeahead-ondemand-source', - 2 => 'javelin-typeahead', - 3 => 'javelin-dom', - 4 => 'javelin-uri', - 5 => 'javelin-util', - 6 => 'javelin-stratcom', - ), '5bc2cb21' => array( 0 => 'javelin-behavior', 1 => 'javelin-stratcom', @@ -1258,12 +1237,6 @@ return array( 0 => 'javelin-magical-init', 1 => 'javelin-util', ), - '61f72a3d' => array( - 0 => 'javelin-install', - 1 => 'javelin-dom', - 2 => 'javelin-vector', - 3 => 'javelin-util', - ), '6453c869' => array( 0 => 'javelin-install', 1 => 'javelin-dom', @@ -1453,17 +1426,6 @@ return array( 1 => 'javelin-uri', 2 => 'phabricator-notification', ), - '92918fcb' => array( - 0 => 'javelin-behavior', - 1 => 'multirow-row-manager', - 2 => 'javelin-dom', - 3 => 'javelin-util', - 4 => 'phabricator-prefab', - 5 => 'javelin-tokenizer', - 6 => 'javelin-typeahead', - 7 => 'javelin-typeahead-preloaded-source', - 8 => 'javelin-json', - ), '92eb531d' => array( 0 => 'javelin-behavior', 1 => 'javelin-dom', @@ -1667,6 +1629,18 @@ return array( 1 => 'javelin-stratcom', 2 => 'javelin-dom', ), + 'bbae734c' => array( + 0 => 'javelin-install', + 1 => 'javelin-util', + 2 => 'javelin-dom', + 3 => 'javelin-typeahead', + 4 => 'javelin-tokenizer', + 5 => 'javelin-typeahead-preloaded-source', + 6 => 'javelin-typeahead-ondemand-source', + 7 => 'javelin-dom', + 8 => 'javelin-stratcom', + 9 => 'javelin-util', + ), 'bd4c8dca' => array( 0 => 'javelin-install', 1 => 'javelin-util', @@ -1767,6 +1741,16 @@ return array( 2 => 'javelin-stratcom', 3 => 'javelin-dom', ), + 'd712ac5f' => array( + 0 => 'javelin-behavior', + 1 => 'javelin-typeahead-ondemand-source', + 2 => 'javelin-typeahead', + 3 => 'javelin-dom', + 4 => 'javelin-uri', + 5 => 'javelin-util', + 6 => 'javelin-stratcom', + 7 => 'phabricator-prefab', + ), 'd75709e6' => array( 0 => 'javelin-behavior', 1 => 'javelin-workflow', @@ -1838,6 +1822,12 @@ return array( 2 => 'javelin-view-visitor', 3 => 'javelin-util', ), + 'e614d22b' => array( + 0 => 'javelin-install', + 1 => 'javelin-dom', + 2 => 'javelin-vector', + 3 => 'javelin-util', + ), 'e9581f08' => array( 0 => 'javelin-behavior', 1 => 'javelin-stratcom', @@ -1958,6 +1948,14 @@ return array( 2 => 'javelin-dom', 3 => 'javelin-typeahead-normalizer', ), + 'fe9a552f' => array( + 0 => 'javelin-behavior', + 1 => 'multirow-row-manager', + 2 => 'javelin-dom', + 3 => 'javelin-util', + 4 => 'phabricator-prefab', + 5 => 'javelin-json', + ), 42126667 => array( 0 => 'javelin-behavior', 1 => 'javelin-dom', diff --git a/resources/sql/autopatches/20140706.pedge.1.sql b/resources/sql/autopatches/20140706.pedge.1.sql new file mode 100644 index 0000000000..3dd049105c --- /dev/null +++ b/resources/sql/autopatches/20140706.pedge.1.sql @@ -0,0 +1,10 @@ +/* PhabricatorProjectObjectHasProjectEdgeType::EDGECONST = 41 */ +/* PhabricatorProjectProjectHasObjectEdgeType::EDGECONST = 42 */ + +INSERT IGNORE INTO {$NAMESPACE}_maniphest.edge (src, type, dst) + SELECT taskPHID, 41, projectPHID + FROM {$NAMESPACE}_maniphest.maniphest_taskproject; + +INSERT IGNORE INTO {$NAMESPACE}_project.edge (src, type, dst) + SELECT projectPHID, 42, taskPHID + FROM {$NAMESPACE}_maniphest.maniphest_taskproject; diff --git a/resources/sql/autopatches/20140711.pnames.1.sql b/resources/sql/autopatches/20140711.pnames.1.sql new file mode 100644 index 0000000000..9fce73a47e --- /dev/null +++ b/resources/sql/autopatches/20140711.pnames.1.sql @@ -0,0 +1,7 @@ +CREATE TABLE {$NAMESPACE}_project.project_datasourcetoken ( + id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, + projectID INT UNSIGNED NOT NULL, + token VARCHAR(128) NOT NULL COLLATE utf8_general_ci, + UNIQUE KEY (token, projectID), + KEY (projectID) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; diff --git a/resources/sql/autopatches/20140711.pnames.2.php b/resources/sql/autopatches/20140711.pnames.2.php new file mode 100644 index 0000000000..ee3658384f --- /dev/null +++ b/resources/sql/autopatches/20140711.pnames.2.php @@ -0,0 +1,11 @@ +getName(); + echo "Updating project '{$name}'...\n"; + $project->updateDatasourceTokens(); +} + +echo "Done.\n"; diff --git a/resources/sql/patches/20130201.revisionunsubscribed.php b/resources/sql/patches/20130201.revisionunsubscribed.php index 38f1e5207e..891be91bc1 100644 --- a/resources/sql/patches/20130201.revisionunsubscribed.php +++ b/resources/sql/patches/20130201.revisionunsubscribed.php @@ -19,7 +19,6 @@ foreach ($revs as $rev) { } $editor = new PhabricatorEdgeEditor(); - $editor->setSuppressEvents(true); foreach ($unsubscribed as $user_phid => $_) { $editor->addEdge( $rev['phid'], diff --git a/resources/sql/patches/20130409.commitdrev.php b/resources/sql/patches/20130409.commitdrev.php index 86d00ac219..1fa7e6f871 100644 --- a/resources/sql/patches/20130409.commitdrev.php +++ b/resources/sql/patches/20130409.commitdrev.php @@ -3,7 +3,7 @@ echo "Migrating differential.revisionPHID to edges...\n"; $commit_table = new PhabricatorRepositoryCommit(); $data_table = new PhabricatorRepositoryCommitData(); -$editor = id(new PhabricatorEdgeEditor())->setSuppressEvents(true); +$editor = new PhabricatorEdgeEditor(); $commit_table->establishConnection('w'); $edges = 0; @@ -24,7 +24,7 @@ foreach (new LiskMigrationIterator($commit_table) as $commit) { if ($edges % 256 == 0) { echo '.'; $editor->save(); - $editor = id(new PhabricatorEdgeEditor())->setSuppressEvents(true); + $editor = new PhabricatorEdgeEditor(); } } diff --git a/resources/sql/patches/20131004.dxreviewers.php b/resources/sql/patches/20131004.dxreviewers.php index 8ff3bc32f8..ab683e2a3f 100644 --- a/resources/sql/patches/20131004.dxreviewers.php +++ b/resources/sql/patches/20131004.dxreviewers.php @@ -25,9 +25,7 @@ foreach (new LiskMigrationIterator($table) as $revision) { continue; } - $editor = id(new PhabricatorEdgeEditor()) - ->setActor(PhabricatorUser::getOmnipotentUser()); - + $editor = new PhabricatorEdgeEditor(); foreach ($reviewer_phids as $dst) { if (phid_get_type($dst) == PhabricatorPHIDConstants::PHID_TYPE_UNKNOWN) { // At least one old install ran into some issues here. Skip the row if we diff --git a/resources/sql/patches/20131121.repocredentials.2.mig.php b/resources/sql/patches/20131121.repocredentials.2.mig.php index 6148ca87df..95fd9a43fa 100644 --- a/resources/sql/patches/20131121.repocredentials.2.mig.php +++ b/resources/sql/patches/20131121.repocredentials.2.mig.php @@ -121,7 +121,6 @@ foreach ($map as $credential_type => $credential_usernames) { $edge_type = PhabricatorEdgeConfig::TYPE_OBJECT_USES_CREDENTIAL; id(new PhabricatorEdgeEditor()) - ->setActor($viewer) ->addEdge($repository->getPHID(), $edge_type, $credential->getPHID()) ->save(); } diff --git a/resources/sql/patches/migrate-differential-dependencies.php b/resources/sql/patches/migrate-differential-dependencies.php index 15301de979..ea2f9c6916 100644 --- a/resources/sql/patches/migrate-differential-dependencies.php +++ b/resources/sql/patches/migrate-differential-dependencies.php @@ -15,7 +15,6 @@ foreach (new LiskMigrationIterator($table) as $rev) { } $editor = new PhabricatorEdgeEditor(); - $editor->setSuppressEvents(true); foreach ($deps as $dep) { $editor->addEdge( $rev->getPHID(), diff --git a/resources/sql/patches/migrate-maniphest-dependencies.php b/resources/sql/patches/migrate-maniphest-dependencies.php index 51f1c944e9..b72d52be8a 100644 --- a/resources/sql/patches/migrate-maniphest-dependencies.php +++ b/resources/sql/patches/migrate-maniphest-dependencies.php @@ -15,7 +15,6 @@ foreach (new LiskMigrationIterator($table) as $task) { } $editor = new PhabricatorEdgeEditor(); - $editor->setSuppressEvents(true); foreach ($deps as $dep) { $editor->addEdge( $task->getPHID(), diff --git a/resources/sql/patches/migrate-maniphest-revisions.php b/resources/sql/patches/migrate-maniphest-revisions.php index 788da47e92..eeb9a7f4e2 100644 --- a/resources/sql/patches/migrate-maniphest-revisions.php +++ b/resources/sql/patches/migrate-maniphest-revisions.php @@ -15,11 +15,10 @@ foreach (new LiskMigrationIterator($table) as $task) { } $editor = new PhabricatorEdgeEditor(); - $editor->setSuppressEvents(true); foreach ($revs as $rev) { $editor->addEdge( $task->getPHID(), - PhabricatorEdgeConfig::TYPE_TASK_HAS_RELATED_DREV, + ManiphestTaskHasRevisionEdgeType::EDGECONST, $rev); } $editor->save(); diff --git a/resources/sql/patches/migrate-project-edges.php b/resources/sql/patches/migrate-project-edges.php index f64fa40efd..844e4434ba 100644 --- a/resources/sql/patches/migrate-project-edges.php +++ b/resources/sql/patches/migrate-project-edges.php @@ -22,7 +22,6 @@ foreach (new LiskMigrationIterator($table) as $proj) { $members = ipull($members, 'userPHID'); $editor = new PhabricatorEdgeEditor(); - $editor->setSuppressEvents(true); foreach ($members as $user_phid) { $editor->addEdge( $proj->getPHID(), diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 218b179f89..63cbca1c4c 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -2,13 +2,13 @@ /** * This file is automatically generated. Use 'arc liberate' to rebuild it. + * * @generated * @phutil-library-version 2 */ phutil_register_library_map(array( '__library_version__' => 2, - 'class' => - array( + 'class' => array( 'Aphront304Response' => 'aphront/response/Aphront304Response.php', 'Aphront400Response' => 'aphront/response/Aphront400Response.php', 'Aphront403Response' => 'aphront/response/Aphront403Response.php', @@ -438,6 +438,7 @@ phutil_register_library_map(array( 'DifferentialRevisionControlSystem' => 'applications/differential/constants/DifferentialRevisionControlSystem.php', 'DifferentialRevisionDetailView' => 'applications/differential/view/DifferentialRevisionDetailView.php', 'DifferentialRevisionEditController' => 'applications/differential/controller/DifferentialRevisionEditController.php', + 'DifferentialRevisionHasTaskEdgeType' => 'applications/differential/edge/DifferentialRevisionHasTaskEdgeType.php', 'DifferentialRevisionIDField' => 'applications/differential/customfield/DifferentialRevisionIDField.php', 'DifferentialRevisionLandController' => 'applications/differential/controller/DifferentialRevisionLandController.php', 'DifferentialRevisionListController' => 'applications/differential/controller/DifferentialRevisionListController.php', @@ -464,6 +465,7 @@ phutil_register_library_map(array( 'DifferentialUnitTestResult' => 'applications/differential/constants/DifferentialUnitTestResult.php', 'DifferentialViewPolicyField' => 'applications/differential/customfield/DifferentialViewPolicyField.php', 'DiffusionArcanistProjectDatasource' => 'applications/diffusion/typeahead/DiffusionArcanistProjectDatasource.php', + 'DiffusionAuditorDatasource' => 'applications/diffusion/typeahead/DiffusionAuditorDatasource.php', 'DiffusionBranchTableController' => 'applications/diffusion/controller/DiffusionBranchTableController.php', 'DiffusionBranchTableView' => 'applications/diffusion/view/DiffusionBranchTableView.php', 'DiffusionBrowseController' => 'applications/diffusion/controller/DiffusionBrowseController.php', @@ -485,6 +487,7 @@ phutil_register_library_map(array( 'DiffusionCommitChangeTableView' => 'applications/diffusion/view/DiffusionCommitChangeTableView.php', 'DiffusionCommitController' => 'applications/diffusion/controller/DiffusionCommitController.php', 'DiffusionCommitEditController' => 'applications/diffusion/controller/DiffusionCommitEditController.php', + 'DiffusionCommitHasTaskEdgeType' => 'applications/diffusion/edge/DiffusionCommitHasTaskEdgeType.php', 'DiffusionCommitHash' => 'applications/diffusion/data/DiffusionCommitHash.php', 'DiffusionCommitHookEngine' => 'applications/diffusion/engine/DiffusionCommitHookEngine.php', 'DiffusionCommitHookRejectException' => 'applications/diffusion/exception/DiffusionCommitHookRejectException.php', @@ -589,6 +592,7 @@ phutil_register_library_map(array( 'DiffusionSvnRawDiffQuery' => 'applications/diffusion/query/rawdiff/DiffusionSvnRawDiffQuery.php', 'DiffusionSvnRequest' => 'applications/diffusion/request/DiffusionSvnRequest.php', 'DiffusionSymbolController' => 'applications/diffusion/controller/DiffusionSymbolController.php', + 'DiffusionSymbolDatasource' => 'applications/diffusion/typeahead/DiffusionSymbolDatasource.php', 'DiffusionSymbolQuery' => 'applications/diffusion/query/DiffusionSymbolQuery.php', 'DiffusionTagListController' => 'applications/diffusion/controller/DiffusionTagListController.php', 'DiffusionTagListView' => 'applications/diffusion/view/DiffusionTagListView.php', @@ -926,7 +930,6 @@ phutil_register_library_map(array( 'ManiphestCustomFieldStorage' => 'applications/maniphest/storage/ManiphestCustomFieldStorage.php', 'ManiphestCustomFieldStringIndex' => 'applications/maniphest/storage/ManiphestCustomFieldStringIndex.php', 'ManiphestDAO' => 'applications/maniphest/storage/ManiphestDAO.php', - 'ManiphestEdgeEventListener' => 'applications/maniphest/event/ManiphestEdgeEventListener.php', 'ManiphestExcelDefaultFormat' => 'applications/maniphest/export/ManiphestExcelDefaultFormat.php', 'ManiphestExcelFormat' => 'applications/maniphest/export/ManiphestExcelFormat.php', 'ManiphestExportController' => 'applications/maniphest/controller/ManiphestExportController.php', @@ -946,13 +949,14 @@ phutil_register_library_map(array( 'ManiphestTaskDescriptionPreviewController' => 'applications/maniphest/controller/ManiphestTaskDescriptionPreviewController.php', 'ManiphestTaskDetailController' => 'applications/maniphest/controller/ManiphestTaskDetailController.php', 'ManiphestTaskEditController' => 'applications/maniphest/controller/ManiphestTaskEditController.php', + 'ManiphestTaskHasCommitEdgeType' => 'applications/maniphest/edge/ManiphestTaskHasCommitEdgeType.php', + 'ManiphestTaskHasRevisionEdgeType' => 'applications/maniphest/edge/ManiphestTaskHasRevisionEdgeType.php', 'ManiphestTaskListController' => 'applications/maniphest/controller/ManiphestTaskListController.php', 'ManiphestTaskListView' => 'applications/maniphest/view/ManiphestTaskListView.php', 'ManiphestTaskMailReceiver' => 'applications/maniphest/mail/ManiphestTaskMailReceiver.php', 'ManiphestTaskOwner' => 'applications/maniphest/constants/ManiphestTaskOwner.php', 'ManiphestTaskPriority' => 'applications/maniphest/constants/ManiphestTaskPriority.php', 'ManiphestTaskPriorityDatasource' => 'applications/maniphest/typeahead/ManiphestTaskPriorityDatasource.php', - 'ManiphestTaskProject' => 'applications/maniphest/storage/ManiphestTaskProject.php', 'ManiphestTaskQuery' => 'applications/maniphest/query/ManiphestTaskQuery.php', 'ManiphestTaskResultListView' => 'applications/maniphest/view/ManiphestTaskResultListView.php', 'ManiphestTaskSearchEngine' => 'applications/maniphest/query/ManiphestTaskSearchEngine.php', @@ -1149,6 +1153,7 @@ phutil_register_library_map(array( 'PhabricatorApplicationCountdown' => 'applications/countdown/application/PhabricatorApplicationCountdown.php', 'PhabricatorApplicationDaemons' => 'applications/daemon/application/PhabricatorApplicationDaemons.php', 'PhabricatorApplicationDashboard' => 'applications/dashboard/application/PhabricatorApplicationDashboard.php', + 'PhabricatorApplicationDatasource' => 'applications/meta/typeahead/PhabricatorApplicationDatasource.php', 'PhabricatorApplicationDetailViewController' => 'applications/meta/controller/PhabricatorApplicationDetailViewController.php', 'PhabricatorApplicationDifferential' => 'applications/differential/application/PhabricatorApplicationDifferential.php', 'PhabricatorApplicationDiffusion' => 'applications/diffusion/application/PhabricatorApplicationDiffusion.php', @@ -1548,7 +1553,7 @@ phutil_register_library_map(array( 'PhabricatorDebugController' => 'applications/system/controller/PhabricatorDebugController.php', 'PhabricatorDefaultFileStorageEngineSelector' => 'applications/files/engineselector/PhabricatorDefaultFileStorageEngineSelector.php', 'PhabricatorDefaultSearchEngineSelector' => 'applications/search/selector/PhabricatorDefaultSearchEngineSelector.php', - 'PhabricatorDestructableInterface' => 'applications/system/interface/PhabricatorDestructableInterface.php', + 'PhabricatorDestructibleInterface' => 'applications/system/interface/PhabricatorDestructibleInterface.php', 'PhabricatorDestructionEngine' => 'applications/system/engine/PhabricatorDestructionEngine.php', 'PhabricatorDeveloperConfigOptions' => 'applications/config/option/PhabricatorDeveloperConfigOptions.php', 'PhabricatorDifferenceEngine' => 'infrastructure/diff/PhabricatorDifferenceEngine.php', @@ -1566,6 +1571,7 @@ phutil_register_library_map(array( 'PhabricatorEdgeGraph' => 'infrastructure/edges/util/PhabricatorEdgeGraph.php', 'PhabricatorEdgeQuery' => 'infrastructure/edges/query/PhabricatorEdgeQuery.php', 'PhabricatorEdgeTestCase' => 'infrastructure/edges/__tests__/PhabricatorEdgeTestCase.php', + 'PhabricatorEdgeType' => 'infrastructure/edges/type/PhabricatorEdgeType.php', 'PhabricatorEditor' => 'infrastructure/PhabricatorEditor.php', 'PhabricatorEmailLoginController' => 'applications/auth/controller/PhabricatorEmailLoginController.php', 'PhabricatorEmailVerificationController' => 'applications/auth/controller/PhabricatorEmailVerificationController.php', @@ -1716,6 +1722,7 @@ phutil_register_library_map(array( 'PhabricatorJavelinLinter' => 'infrastructure/lint/linter/PhabricatorJavelinLinter.php', 'PhabricatorJumpNavHandler' => 'applications/search/engine/PhabricatorJumpNavHandler.php', 'PhabricatorKeyValueDatabaseCache' => 'applications/cache/PhabricatorKeyValueDatabaseCache.php', + 'PhabricatorLegacyEdgeType' => 'infrastructure/edges/type/PhabricatorLegacyEdgeType.php', 'PhabricatorLegalpadConfigOptions' => 'applications/legalpad/config/PhabricatorLegalpadConfigOptions.php', 'PhabricatorLegalpadPHIDTypeDocument' => 'applications/legalpad/phid/PhabricatorLegalpadPHIDTypeDocument.php', 'PhabricatorLipsumArtist' => 'applications/lipsum/image/PhabricatorLipsumArtist.php', @@ -1768,6 +1775,7 @@ phutil_register_library_map(array( 'PhabricatorMailReceiverTestCase' => 'applications/metamta/receiver/__tests__/PhabricatorMailReceiverTestCase.php', 'PhabricatorMailReplyHandler' => 'applications/metamta/replyhandler/PhabricatorMailReplyHandler.php', 'PhabricatorMailgunConfigOptions' => 'applications/config/option/PhabricatorMailgunConfigOptions.php', + 'PhabricatorMailingListDatasource' => 'applications/mailinglists/typeahead/PhabricatorMailingListDatasource.php', 'PhabricatorMailingListPHIDTypeList' => 'applications/mailinglists/phid/PhabricatorMailingListPHIDTypeList.php', 'PhabricatorMailingListQuery' => 'applications/mailinglists/query/PhabricatorMailingListQuery.php', 'PhabricatorMailingListSearchEngine' => 'applications/mailinglists/query/PhabricatorMailingListSearchEngine.php', @@ -1800,6 +1808,7 @@ phutil_register_library_map(array( 'PhabricatorMetaMTAMailBody' => 'applications/metamta/view/PhabricatorMetaMTAMailBody.php', 'PhabricatorMetaMTAMailBodyTestCase' => 'applications/metamta/view/__tests__/PhabricatorMetaMTAMailBodyTestCase.php', 'PhabricatorMetaMTAMailTestCase' => 'applications/metamta/storage/__tests__/PhabricatorMetaMTAMailTestCase.php', + 'PhabricatorMetaMTAMailableDatasource' => 'applications/metamta/typeahead/PhabricatorMetaMTAMailableDatasource.php', 'PhabricatorMetaMTAMailgunReceiveController' => 'applications/metamta/controller/PhabricatorMetaMTAMailgunReceiveController.php', 'PhabricatorMetaMTAMailingList' => 'applications/mailinglists/storage/PhabricatorMetaMTAMailingList.php', 'PhabricatorMetaMTAMemberQuery' => 'applications/metamta/query/PhabricatorMetaMTAMemberQuery.php', @@ -1830,7 +1839,7 @@ phutil_register_library_map(array( 'PhabricatorNotificationTestController' => 'applications/notification/controller/PhabricatorNotificationTestController.php', 'PhabricatorOAuthClientAuthorization' => 'applications/oauthserver/storage/PhabricatorOAuthClientAuthorization.php', 'PhabricatorOAuthClientAuthorizationQuery' => 'applications/oauthserver/query/PhabricatorOAuthClientAuthorizationQuery.php', - 'PhabricatorOAuthClientBaseController' => 'applications/oauthserver/controller/client/PhabricatorOAuthClientBaseController.php', + 'PhabricatorOAuthClientController' => 'applications/oauthserver/controller/client/PhabricatorOAuthClientController.php', 'PhabricatorOAuthClientDeleteController' => 'applications/oauthserver/controller/client/PhabricatorOAuthClientDeleteController.php', 'PhabricatorOAuthClientEditController' => 'applications/oauthserver/controller/client/PhabricatorOAuthClientEditController.php', 'PhabricatorOAuthClientListController' => 'applications/oauthserver/controller/client/PhabricatorOAuthClientListController.php', @@ -1910,6 +1919,7 @@ phutil_register_library_map(array( 'PhabricatorPeopleCalendarController' => 'applications/people/controller/PhabricatorPeopleCalendarController.php', 'PhabricatorPeopleController' => 'applications/people/controller/PhabricatorPeopleController.php', 'PhabricatorPeopleCreateController' => 'applications/people/controller/PhabricatorPeopleCreateController.php', + 'PhabricatorPeopleDatasource' => 'applications/people/typeahead/PhabricatorPeopleDatasource.php', 'PhabricatorPeopleDeleteController' => 'applications/people/controller/PhabricatorPeopleDeleteController.php', 'PhabricatorPeopleDisableController' => 'applications/people/controller/PhabricatorPeopleDisableController.php', 'PhabricatorPeopleEmpowerController' => 'applications/people/controller/PhabricatorPeopleEmpowerController.php', @@ -2007,9 +2017,12 @@ phutil_register_library_map(array( 'PhabricatorProjectMembersRemoveController' => 'applications/project/controller/PhabricatorProjectMembersRemoveController.php', 'PhabricatorProjectMoveController' => 'applications/project/controller/PhabricatorProjectMoveController.php', 'PhabricatorProjectNameCollisionException' => 'applications/project/exception/PhabricatorProjectNameCollisionException.php', + 'PhabricatorProjectObjectHasProjectEdgeType' => 'applications/project/edge/PhabricatorProjectObjectHasProjectEdgeType.php', + 'PhabricatorProjectOrUserDatasource' => 'applications/project/typeahead/PhabricatorProjectOrUserDatasource.php', 'PhabricatorProjectPHIDTypeColumn' => 'applications/project/phid/PhabricatorProjectPHIDTypeColumn.php', 'PhabricatorProjectPHIDTypeProject' => 'applications/project/phid/PhabricatorProjectPHIDTypeProject.php', 'PhabricatorProjectProfileController' => 'applications/project/controller/PhabricatorProjectProfileController.php', + 'PhabricatorProjectProjectHasObjectEdgeType' => 'applications/project/edge/PhabricatorProjectProjectHasObjectEdgeType.php', 'PhabricatorProjectQuery' => 'applications/project/query/PhabricatorProjectQuery.php', 'PhabricatorProjectSearchEngine' => 'applications/project/query/PhabricatorProjectSearchEngine.php', 'PhabricatorProjectSearchIndexer' => 'applications/project/search/PhabricatorProjectSearchIndexer.php', @@ -2150,6 +2163,7 @@ phutil_register_library_map(array( 'PhabricatorSearchConfigOptions' => 'applications/search/config/PhabricatorSearchConfigOptions.php', 'PhabricatorSearchController' => 'applications/search/controller/PhabricatorSearchController.php', 'PhabricatorSearchDAO' => 'applications/search/storage/PhabricatorSearchDAO.php', + 'PhabricatorSearchDatasource' => 'applications/search/typeahead/PhabricatorSearchDatasource.php', 'PhabricatorSearchDeleteController' => 'applications/search/controller/PhabricatorSearchDeleteController.php', 'PhabricatorSearchDocument' => 'applications/search/storage/document/PhabricatorSearchDocument.php', 'PhabricatorSearchDocumentField' => 'applications/search/storage/document/PhabricatorSearchDocumentField.php', @@ -2324,12 +2338,13 @@ phutil_register_library_map(array( 'PhabricatorTranslationsConfigOptions' => 'applications/config/option/PhabricatorTranslationsConfigOptions.php', 'PhabricatorTrivialTestCase' => 'infrastructure/testing/__tests__/PhabricatorTrivialTestCase.php', 'PhabricatorTwoColumnExample' => 'applications/uiexample/examples/PhabricatorTwoColumnExample.php', - 'PhabricatorTypeaheadCommonDatasourceController' => 'applications/typeahead/controller/PhabricatorTypeaheadCommonDatasourceController.php', 'PhabricatorTypeaheadCompositeDatasource' => 'applications/typeahead/datasource/PhabricatorTypeaheadCompositeDatasource.php', 'PhabricatorTypeaheadDatasource' => 'applications/typeahead/datasource/PhabricatorTypeaheadDatasource.php', 'PhabricatorTypeaheadDatasourceController' => 'applications/typeahead/controller/PhabricatorTypeaheadDatasourceController.php', 'PhabricatorTypeaheadModularDatasourceController' => 'applications/typeahead/controller/PhabricatorTypeaheadModularDatasourceController.php', 'PhabricatorTypeaheadMonogramDatasource' => 'applications/typeahead/datasource/PhabricatorTypeaheadMonogramDatasource.php', + 'PhabricatorTypeaheadNoOwnerDatasource' => 'applications/typeahead/datasource/PhabricatorTypeaheadNoOwnerDatasource.php', + 'PhabricatorTypeaheadOwnerDatasource' => 'applications/typeahead/datasource/PhabricatorTypeaheadOwnerDatasource.php', 'PhabricatorTypeaheadResult' => 'applications/typeahead/storage/PhabricatorTypeaheadResult.php', 'PhabricatorTypeaheadRuntimeCompositeDatasource' => 'applications/typeahead/datasource/PhabricatorTypeaheadRuntimeCompositeDatasource.php', 'PhabricatorUIConfigOptions' => 'applications/config/option/PhabricatorUIConfigOptions.php', @@ -2555,6 +2570,7 @@ phutil_register_library_map(array( 'PhrequentSearchEngine' => 'applications/phrequent/query/PhrequentSearchEngine.php', 'PhrequentTimeBlock' => 'applications/phrequent/storage/PhrequentTimeBlock.php', 'PhrequentTimeBlockTestCase' => 'applications/phrequent/storage/__tests__/PhrequentTimeBlockTestCase.php', + 'PhrequentTimeSlices' => 'applications/phrequent/storage/PhrequentTimeSlices.php', 'PhrequentTrackController' => 'applications/phrequent/controller/PhrequentTrackController.php', 'PhrequentTrackableInterface' => 'applications/phrequent/interface/PhrequentTrackableInterface.php', 'PhrequentTrackingEditor' => 'applications/phrequent/editor/PhrequentTrackingEditor.php', @@ -2712,8 +2728,7 @@ phutil_register_library_map(array( 'SubscriptionListDialogBuilder' => 'applications/subscriptions/view/SubscriptionListDialogBuilder.php', 'SubscriptionListStringBuilder' => 'applications/subscriptions/view/SubscriptionListStringBuilder.php', ), - 'function' => - array( + 'function' => array( '_phabricator_time_format' => 'view/viewutils.php', 'celerity_generate_unique_node_id' => 'infrastructure/celerity/api.php', 'celerity_get_resource_uri' => 'infrastructure/celerity/api.php', @@ -2731,8 +2746,7 @@ phutil_register_library_map(array( 'phid_group_by_type' => 'applications/phid/utils.php', 'require_celerity_resource' => 'infrastructure/celerity/api.php', ), - 'xmap' => - array( + 'xmap' => array( 'Aphront304Response' => 'AphrontResponse', 'Aphront400Response' => 'AphrontResponse', 'Aphront403Response' => 'AphrontHTMLResponse', @@ -2809,10 +2823,9 @@ phutil_register_library_map(array( 'AphrontTwoColumnView' => 'AphrontView', 'AphrontTypeaheadTemplateView' => 'AphrontView', 'AphrontUsageException' => 'AphrontException', - 'AphrontView' => - array( - 0 => 'Phobject', - 1 => 'PhutilSafeHTMLProducerInterface', + 'AphrontView' => array( + 'Phobject', + 'PhutilSafeHTMLProducerInterface', ), 'AphrontWebpageResponse' => 'AphrontHTMLResponse', 'AuditActionMenuEventListener' => 'PhabricatorEventListener', @@ -2827,10 +2840,9 @@ phutil_register_library_map(array( 'CelerityResourceGraph' => 'AbstractDirectedGraph', 'CelerityResourceTransformerTestCase' => 'PhabricatorTestCase', 'CelerityResourcesOnDisk' => 'CelerityPhysicalResources', - 'ConduitAPIMethod' => - array( - 0 => 'Phobject', - 1 => 'PhabricatorPolicyInterface', + 'ConduitAPIMethod' => array( + 'Phobject', + 'PhabricatorPolicyInterface', ), 'ConduitAPI_arcanist_Method' => 'ConduitAPIMethod', 'ConduitAPI_arcanist_projectinfo_Method' => 'ConduitAPI_arcanist_Method', @@ -3011,10 +3023,9 @@ phutil_register_library_map(array( 'ConpherencePeopleWidgetView' => 'ConpherenceWidgetView', 'ConpherenceReplyHandler' => 'PhabricatorMailReplyHandler', 'ConpherenceSettings' => 'ConpherenceConstants', - 'ConpherenceThread' => - array( - 0 => 'ConpherenceDAO', - 1 => 'PhabricatorPolicyInterface', + 'ConpherenceThread' => array( + 'ConpherenceDAO', + 'PhabricatorPolicyInterface', ), 'ConpherenceThreadListView' => 'AphrontView', 'ConpherenceThreadMailReceiver' => 'PhabricatorObjectMailReceiver', @@ -3050,10 +3061,9 @@ phutil_register_library_map(array( 'DifferentialBranchField' => 'DifferentialCustomField', 'DifferentialCapabilityDefaultView' => 'PhabricatorPolicyCapability', 'DifferentialChangesSinceLastUpdateField' => 'DifferentialCustomField', - 'DifferentialChangeset' => - array( - 0 => 'DifferentialDAO', - 1 => 'PhabricatorPolicyInterface', + 'DifferentialChangeset' => array( + 'DifferentialDAO', + 'PhabricatorPolicyInterface', ), 'DifferentialChangesetDetailView' => 'AphrontView', 'DifferentialChangesetHTMLRenderer' => 'DifferentialChangesetRenderer', @@ -3084,13 +3094,12 @@ phutil_register_library_map(array( 'DifferentialDAO' => 'PhabricatorLiskDAO', 'DifferentialDependenciesField' => 'DifferentialCustomField', 'DifferentialDependsOnField' => 'DifferentialCustomField', - 'DifferentialDiff' => - array( - 0 => 'DifferentialDAO', - 1 => 'PhabricatorPolicyInterface', - 2 => 'HarbormasterBuildableInterface', - 3 => 'PhabricatorApplicationTransactionInterface', - 4 => 'PhabricatorDestructableInterface', + 'DifferentialDiff' => array( + 'DifferentialDAO', + 'PhabricatorPolicyInterface', + 'HarbormasterBuildableInterface', + 'PhabricatorApplicationTransactionInterface', + 'PhabricatorDestructibleInterface', ), 'DifferentialDiffCreateController' => 'DifferentialController', 'DifferentialDiffProperty' => 'DifferentialDAO', @@ -3106,10 +3115,9 @@ phutil_register_library_map(array( 'DifferentialGitSVNIDField' => 'DifferentialCustomField', 'DifferentialHostField' => 'DifferentialCustomField', 'DifferentialHovercardEventListener' => 'PhabricatorEventListener', - 'DifferentialHunk' => - array( - 0 => 'DifferentialDAO', - 1 => 'PhabricatorPolicyInterface', + 'DifferentialHunk' => array( + 'DifferentialDAO', + 'PhabricatorPolicyInterface', ), 'DifferentialHunkLegacy' => 'DifferentialHunk', 'DifferentialHunkModern' => 'DifferentialHunk', @@ -3149,22 +3157,22 @@ phutil_register_library_map(array( 'DifferentialReviewedByField' => 'DifferentialCoreCustomField', 'DifferentialReviewersField' => 'DifferentialCoreCustomField', 'DifferentialReviewersView' => 'AphrontView', - 'DifferentialRevision' => - array( - 0 => 'DifferentialDAO', - 1 => 'PhabricatorTokenReceiverInterface', - 2 => 'PhabricatorPolicyInterface', - 3 => 'PhabricatorFlaggableInterface', - 4 => 'PhrequentTrackableInterface', - 5 => 'HarbormasterBuildableInterface', - 6 => 'PhabricatorSubscribableInterface', - 7 => 'PhabricatorCustomFieldInterface', - 8 => 'PhabricatorApplicationTransactionInterface', - 9 => 'PhabricatorDestructableInterface', - 10 => 'PhabricatorProjectInterface', + 'DifferentialRevision' => array( + 'DifferentialDAO', + 'PhabricatorTokenReceiverInterface', + 'PhabricatorPolicyInterface', + 'PhabricatorFlaggableInterface', + 'PhrequentTrackableInterface', + 'HarbormasterBuildableInterface', + 'PhabricatorSubscribableInterface', + 'PhabricatorCustomFieldInterface', + 'PhabricatorApplicationTransactionInterface', + 'PhabricatorDestructibleInterface', + 'PhabricatorProjectInterface', ), 'DifferentialRevisionDetailView' => 'AphrontView', 'DifferentialRevisionEditController' => 'DifferentialController', + 'DifferentialRevisionHasTaskEdgeType' => 'PhabricatorEdgeType', 'DifferentialRevisionIDField' => 'DifferentialCustomField', 'DifferentialRevisionLandController' => 'DifferentialController', 'DifferentialRevisionListController' => 'DifferentialController', @@ -3188,6 +3196,7 @@ phutil_register_library_map(array( 'DifferentialUnitField' => 'DifferentialCustomField', 'DifferentialViewPolicyField' => 'DifferentialCoreCustomField', 'DiffusionArcanistProjectDatasource' => 'PhabricatorTypeaheadDatasource', + 'DiffusionAuditorDatasource' => 'PhabricatorTypeaheadCompositeDatasource', 'DiffusionBranchTableController' => 'DiffusionController', 'DiffusionBranchTableView' => 'DiffusionView', 'DiffusionBrowseController' => 'DiffusionController', @@ -3208,6 +3217,7 @@ phutil_register_library_map(array( 'DiffusionCommitChangeTableView' => 'DiffusionView', 'DiffusionCommitController' => 'DiffusionController', 'DiffusionCommitEditController' => 'DiffusionController', + 'DiffusionCommitHasTaskEdgeType' => 'PhabricatorEdgeType', 'DiffusionCommitHash' => 'Phobject', 'DiffusionCommitHookEngine' => 'Phobject', 'DiffusionCommitHookRejectException' => 'Exception', @@ -3300,6 +3310,7 @@ phutil_register_library_map(array( 'DiffusionSvnRawDiffQuery' => 'DiffusionRawDiffQuery', 'DiffusionSvnRequest' => 'DiffusionRequest', 'DiffusionSymbolController' => 'DiffusionController', + 'DiffusionSymbolDatasource' => 'PhabricatorTypeaheadDatasource', 'DiffusionSymbolQuery' => 'PhabricatorOffsetPagedQuery', 'DiffusionTagListController' => 'DiffusionController', 'DiffusionTagListView' => 'DiffusionView', @@ -3322,17 +3333,15 @@ phutil_register_library_map(array( 'DivinerFindController' => 'DivinerController', 'DivinerGenerateWorkflow' => 'DivinerWorkflow', 'DivinerLiveAtom' => 'DivinerDAO', - 'DivinerLiveBook' => - array( - 0 => 'DivinerDAO', - 1 => 'PhabricatorPolicyInterface', + 'DivinerLiveBook' => array( + 'DivinerDAO', + 'PhabricatorPolicyInterface', ), 'DivinerLivePublisher' => 'DivinerPublisher', - 'DivinerLiveSymbol' => - array( - 0 => 'DivinerDAO', - 1 => 'PhabricatorPolicyInterface', - 2 => 'PhabricatorMarkupInterface', + 'DivinerLiveSymbol' => array( + 'DivinerDAO', + 'PhabricatorPolicyInterface', + 'PhabricatorMarkupInterface', ), 'DivinerMainController' => 'DivinerController', 'DivinerPHIDTypeAtom' => 'PhabricatorPHIDType', @@ -3350,10 +3359,9 @@ phutil_register_library_map(array( 'DoorkeeperBridgeJIRA' => 'DoorkeeperBridge', 'DoorkeeperBridgeJIRATestCase' => 'PhabricatorTestCase', 'DoorkeeperDAO' => 'PhabricatorLiskDAO', - 'DoorkeeperExternalObject' => - array( - 0 => 'DoorkeeperDAO', - 1 => 'PhabricatorPolicyInterface', + 'DoorkeeperExternalObject' => array( + 'DoorkeeperDAO', + 'PhabricatorPolicyInterface', ), 'DoorkeeperExternalObjectQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', 'DoorkeeperFeedWorker' => 'FeedPushWorker', @@ -3369,10 +3377,9 @@ phutil_register_library_map(array( 'DoorkeeperTagsController' => 'PhabricatorController', 'DrydockAllocatorWorker' => 'PhabricatorWorker', 'DrydockApacheWebrootInterface' => 'DrydockWebrootInterface', - 'DrydockBlueprint' => - array( - 0 => 'DrydockDAO', - 1 => 'PhabricatorPolicyInterface', + 'DrydockBlueprint' => array( + 'DrydockDAO', + 'PhabricatorPolicyInterface', ), 'DrydockBlueprintController' => 'DrydockController', 'DrydockBlueprintCreateController' => 'DrydockBlueprintController', @@ -3392,10 +3399,9 @@ phutil_register_library_map(array( 'DrydockController' => 'PhabricatorController', 'DrydockDAO' => 'PhabricatorLiskDAO', 'DrydockFilesystemInterface' => 'DrydockInterface', - 'DrydockLease' => - array( - 0 => 'DrydockDAO', - 1 => 'PhabricatorPolicyInterface', + 'DrydockLease' => array( + 'DrydockDAO', + 'PhabricatorPolicyInterface', ), 'DrydockLeaseController' => 'DrydockController', 'DrydockLeaseListController' => 'DrydockLeaseController', @@ -3407,10 +3413,9 @@ phutil_register_library_map(array( 'DrydockLeaseViewController' => 'DrydockLeaseController', 'DrydockLocalCommandInterface' => 'DrydockCommandInterface', 'DrydockLocalHostBlueprintImplementation' => 'DrydockBlueprintImplementation', - 'DrydockLog' => - array( - 0 => 'DrydockDAO', - 1 => 'PhabricatorPolicyInterface', + 'DrydockLog' => array( + 'DrydockDAO', + 'PhabricatorPolicyInterface', ), 'DrydockLogController' => 'DrydockController', 'DrydockLogListController' => 'DrydockLogController', @@ -3427,10 +3432,9 @@ phutil_register_library_map(array( 'DrydockPHIDTypeResource' => 'PhabricatorPHIDType', 'DrydockPreallocatedHostBlueprintImplementation' => 'DrydockBlueprintImplementation', 'DrydockQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', - 'DrydockResource' => - array( - 0 => 'DrydockDAO', - 1 => 'PhabricatorPolicyInterface', + 'DrydockResource' => array( + 'DrydockDAO', + 'PhabricatorPolicyInterface', ), 'DrydockResourceCloseController' => 'DrydockResourceController', 'DrydockResourceController' => 'DrydockController', @@ -3450,39 +3454,34 @@ phutil_register_library_map(array( 'FileCreateMailReceiver' => 'PhabricatorMailReceiver', 'FileMailReceiver' => 'PhabricatorObjectMailReceiver', 'FileReplyHandler' => 'PhabricatorMailReplyHandler', - 'HarbormasterBuild' => - array( - 0 => 'HarbormasterDAO', - 1 => 'PhabricatorPolicyInterface', + 'HarbormasterBuild' => array( + 'HarbormasterDAO', + 'PhabricatorPolicyInterface', ), 'HarbormasterBuildActionController' => 'HarbormasterController', - 'HarbormasterBuildArtifact' => - array( - 0 => 'HarbormasterDAO', - 1 => 'PhabricatorPolicyInterface', + 'HarbormasterBuildArtifact' => array( + 'HarbormasterDAO', + 'PhabricatorPolicyInterface', ), 'HarbormasterBuildArtifactQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', 'HarbormasterBuildCommand' => 'HarbormasterDAO', 'HarbormasterBuildEngine' => 'Phobject', 'HarbormasterBuildItem' => 'HarbormasterDAO', 'HarbormasterBuildItemQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', - 'HarbormasterBuildLog' => - array( - 0 => 'HarbormasterDAO', - 1 => 'PhabricatorPolicyInterface', + 'HarbormasterBuildLog' => array( + 'HarbormasterDAO', + 'PhabricatorPolicyInterface', ), 'HarbormasterBuildLogQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', - 'HarbormasterBuildMessage' => - array( - 0 => 'HarbormasterDAO', - 1 => 'PhabricatorPolicyInterface', + 'HarbormasterBuildMessage' => array( + 'HarbormasterDAO', + 'PhabricatorPolicyInterface', ), 'HarbormasterBuildMessageQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', - 'HarbormasterBuildPlan' => - array( - 0 => 'HarbormasterDAO', - 1 => 'PhabricatorPolicyInterface', - 2 => 'PhabricatorSubscribableInterface', + 'HarbormasterBuildPlan' => array( + 'HarbormasterDAO', + 'PhabricatorPolicyInterface', + 'PhabricatorSubscribableInterface', ), 'HarbormasterBuildPlanDatasource' => 'PhabricatorTypeaheadDatasource', 'HarbormasterBuildPlanEditor' => 'PhabricatorApplicationTransactionEditor', @@ -3492,26 +3491,23 @@ phutil_register_library_map(array( 'HarbormasterBuildPlanTransactionComment' => 'PhabricatorApplicationTransactionComment', 'HarbormasterBuildPlanTransactionQuery' => 'PhabricatorApplicationTransactionQuery', 'HarbormasterBuildQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', - 'HarbormasterBuildStep' => - array( - 0 => 'HarbormasterDAO', - 1 => 'PhabricatorPolicyInterface', - 2 => 'PhabricatorCustomFieldInterface', + 'HarbormasterBuildStep' => array( + 'HarbormasterDAO', + 'PhabricatorPolicyInterface', + 'PhabricatorCustomFieldInterface', ), - 'HarbormasterBuildStepCoreCustomField' => - array( - 0 => 'HarbormasterBuildStepCustomField', - 1 => 'PhabricatorStandardCustomFieldInterface', + 'HarbormasterBuildStepCoreCustomField' => array( + 'HarbormasterBuildStepCustomField', + 'PhabricatorStandardCustomFieldInterface', ), 'HarbormasterBuildStepCustomField' => 'PhabricatorCustomField', 'HarbormasterBuildStepEditor' => 'PhabricatorApplicationTransactionEditor', 'HarbormasterBuildStepQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', 'HarbormasterBuildStepTransaction' => 'PhabricatorApplicationTransaction', 'HarbormasterBuildStepTransactionQuery' => 'PhabricatorApplicationTransactionQuery', - 'HarbormasterBuildTarget' => - array( - 0 => 'HarbormasterDAO', - 1 => 'PhabricatorPolicyInterface', + 'HarbormasterBuildTarget' => array( + 'HarbormasterDAO', + 'PhabricatorPolicyInterface', ), 'HarbormasterBuildTargetQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', 'HarbormasterBuildTransaction' => 'PhabricatorApplicationTransaction', @@ -3519,11 +3515,10 @@ phutil_register_library_map(array( 'HarbormasterBuildTransactionQuery' => 'PhabricatorApplicationTransactionQuery', 'HarbormasterBuildViewController' => 'HarbormasterController', 'HarbormasterBuildWorker' => 'HarbormasterWorker', - 'HarbormasterBuildable' => - array( - 0 => 'HarbormasterDAO', - 1 => 'PhabricatorPolicyInterface', - 2 => 'HarbormasterBuildableInterface', + 'HarbormasterBuildable' => array( + 'HarbormasterDAO', + 'PhabricatorPolicyInterface', + 'HarbormasterBuildableInterface', ), 'HarbormasterBuildableActionController' => 'HarbormasterController', 'HarbormasterBuildableListController' => 'HarbormasterController', @@ -3592,12 +3587,11 @@ phutil_register_library_map(array( 'HeraldPreCommitRefAdapter' => 'HeraldPreCommitAdapter', 'HeraldRecursiveConditionsException' => 'Exception', 'HeraldRemarkupRule' => 'PhabricatorRemarkupRuleObject', - 'HeraldRule' => - array( - 0 => 'HeraldDAO', - 1 => 'PhabricatorFlaggableInterface', - 2 => 'PhabricatorPolicyInterface', - 3 => 'PhabricatorDestructableInterface', + 'HeraldRule' => array( + 'HeraldDAO', + 'PhabricatorFlaggableInterface', + 'PhabricatorPolicyInterface', + 'PhabricatorDestructibleInterface', ), 'HeraldRuleController' => 'HeraldController', 'HeraldRuleEdit' => 'HeraldDAO', @@ -3612,10 +3606,9 @@ phutil_register_library_map(array( 'HeraldRuleViewController' => 'HeraldController', 'HeraldTestConsoleController' => 'HeraldController', 'HeraldTransactionQuery' => 'PhabricatorApplicationTransactionQuery', - 'HeraldTranscript' => - array( - 0 => 'HeraldDAO', - 1 => 'PhabricatorPolicyInterface', + 'HeraldTranscript' => array( + 'HeraldDAO', + 'PhabricatorPolicyInterface', ), 'HeraldTranscriptController' => 'HeraldController', 'HeraldTranscriptGarbageCollector' => 'PhabricatorGarbageCollector', @@ -3632,18 +3625,16 @@ phutil_register_library_map(array( 'LegalpadCapabilityDefaultView' => 'PhabricatorPolicyCapability', 'LegalpadController' => 'PhabricatorController', 'LegalpadDAO' => 'PhabricatorLiskDAO', - 'LegalpadDocument' => - array( - 0 => 'LegalpadDAO', - 1 => 'PhabricatorPolicyInterface', - 2 => 'PhabricatorSubscribableInterface', - 3 => 'PhabricatorApplicationTransactionInterface', - 4 => 'PhabricatorDestructableInterface', + 'LegalpadDocument' => array( + 'LegalpadDAO', + 'PhabricatorPolicyInterface', + 'PhabricatorSubscribableInterface', + 'PhabricatorApplicationTransactionInterface', + 'PhabricatorDestructibleInterface', ), - 'LegalpadDocumentBody' => - array( - 0 => 'LegalpadDAO', - 1 => 'PhabricatorMarkupInterface', + 'LegalpadDocumentBody' => array( + 'LegalpadDAO', + 'PhabricatorMarkupInterface', ), 'LegalpadDocumentCommentController' => 'LegalpadController', 'LegalpadDocumentDatasource' => 'PhabricatorTypeaheadDatasource', @@ -3656,10 +3647,9 @@ phutil_register_library_map(array( 'LegalpadDocumentRemarkupRule' => 'PhabricatorRemarkupRuleObject', 'LegalpadDocumentSearchEngine' => 'PhabricatorApplicationSearchEngine', 'LegalpadDocumentSignController' => 'LegalpadController', - 'LegalpadDocumentSignature' => - array( - 0 => 'LegalpadDAO', - 1 => 'PhabricatorPolicyInterface', + 'LegalpadDocumentSignature' => array( + 'LegalpadDAO', + 'PhabricatorPolicyInterface', ), 'LegalpadDocumentSignatureAddController' => 'LegalpadController', 'LegalpadDocumentSignatureListController' => 'LegalpadController', @@ -3693,10 +3683,9 @@ phutil_register_library_map(array( 'ManiphestCapabilityEditPriority' => 'PhabricatorPolicyCapability', 'ManiphestCapabilityEditProjects' => 'PhabricatorPolicyCapability', 'ManiphestCapabilityEditStatus' => 'PhabricatorPolicyCapability', - 'ManiphestConfiguredCustomField' => - array( - 0 => 'ManiphestCustomField', - 1 => 'PhabricatorStandardCustomFieldInterface', + 'ManiphestConfiguredCustomField' => array( + 'ManiphestCustomField', + 'PhabricatorStandardCustomFieldInterface', ), 'ManiphestController' => 'PhabricatorController', 'ManiphestCreateMailReceiver' => 'PhabricatorMailReceiver', @@ -3707,7 +3696,6 @@ phutil_register_library_map(array( 'ManiphestCustomFieldStorage' => 'PhabricatorCustomFieldStorage', 'ManiphestCustomFieldStringIndex' => 'PhabricatorCustomFieldStringIndexStorage', 'ManiphestDAO' => 'PhabricatorLiskDAO', - 'ManiphestEdgeEventListener' => 'PhabricatorEventListener', 'ManiphestExcelDefaultFormat' => 'ManiphestExcelFormat', 'ManiphestExportController' => 'ManiphestController', 'ManiphestHovercardEventListener' => 'PhabricatorEventListener', @@ -3722,27 +3710,28 @@ phutil_register_library_map(array( 'ManiphestStatusConfigOptionType' => 'PhabricatorConfigJSONOptionType', 'ManiphestSubpriorityController' => 'ManiphestController', 'ManiphestSubscribeController' => 'ManiphestController', - 'ManiphestTask' => - array( - 0 => 'ManiphestDAO', - 1 => 'PhabricatorMarkupInterface', - 2 => 'PhabricatorPolicyInterface', - 3 => 'PhabricatorTokenReceiverInterface', - 4 => 'PhabricatorFlaggableInterface', - 5 => 'PhrequentTrackableInterface', - 6 => 'PhabricatorCustomFieldInterface', - 7 => 'PhabricatorDestructableInterface', + 'ManiphestTask' => array( + 'ManiphestDAO', + 'PhabricatorMarkupInterface', + 'PhabricatorPolicyInterface', + 'PhabricatorTokenReceiverInterface', + 'PhabricatorFlaggableInterface', + 'PhrequentTrackableInterface', + 'PhabricatorCustomFieldInterface', + 'PhabricatorDestructibleInterface', + 'PhabricatorApplicationTransactionInterface', ), 'ManiphestTaskDescriptionPreviewController' => 'ManiphestController', 'ManiphestTaskDetailController' => 'ManiphestController', 'ManiphestTaskEditController' => 'ManiphestController', + 'ManiphestTaskHasCommitEdgeType' => 'PhabricatorEdgeType', + 'ManiphestTaskHasRevisionEdgeType' => 'PhabricatorEdgeType', 'ManiphestTaskListController' => 'ManiphestController', 'ManiphestTaskListView' => 'ManiphestView', 'ManiphestTaskMailReceiver' => 'PhabricatorObjectMailReceiver', 'ManiphestTaskOwner' => 'ManiphestConstants', 'ManiphestTaskPriority' => 'ManiphestConstants', 'ManiphestTaskPriorityDatasource' => 'PhabricatorTypeaheadDatasource', - 'ManiphestTaskProject' => 'ManiphestDAO', 'ManiphestTaskQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', 'ManiphestTaskResultListView' => 'ManiphestView', 'ManiphestTaskSearchEngine' => 'PhabricatorApplicationSearchEngine', @@ -3765,10 +3754,9 @@ phutil_register_library_map(array( 'NuanceCapabilitySourceManage' => 'PhabricatorPolicyCapability', 'NuanceController' => 'PhabricatorController', 'NuanceDAO' => 'PhabricatorLiskDAO', - 'NuanceItem' => - array( - 0 => 'NuanceDAO', - 1 => 'PhabricatorPolicyInterface', + 'NuanceItem' => array( + 'NuanceDAO', + 'PhabricatorPolicyInterface', ), 'NuanceItemEditController' => 'NuanceController', 'NuanceItemEditor' => 'PhabricatorApplicationTransactionEditor', @@ -3783,10 +3771,9 @@ phutil_register_library_map(array( 'NuancePHIDTypeSource' => 'PhabricatorPHIDType', 'NuancePhabricatorFormSourceDefinition' => 'NuanceSourceDefinition', 'NuanceQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', - 'NuanceQueue' => - array( - 0 => 'NuanceDAO', - 1 => 'PhabricatorPolicyInterface', + 'NuanceQueue' => array( + 'NuanceDAO', + 'PhabricatorPolicyInterface', ), 'NuanceQueueEditController' => 'NuanceController', 'NuanceQueueEditor' => 'PhabricatorApplicationTransactionEditor', @@ -3805,10 +3792,9 @@ phutil_register_library_map(array( 'NuanceRequestorTransactionComment' => 'PhabricatorApplicationTransactionComment', 'NuanceRequestorTransactionQuery' => 'PhabricatorApplicationTransactionQuery', 'NuanceRequestorViewController' => 'NuanceController', - 'NuanceSource' => - array( - 0 => 'NuanceDAO', - 1 => 'PhabricatorPolicyInterface', + 'NuanceSource' => array( + 'NuanceDAO', + 'PhabricatorPolicyInterface', ), 'NuanceSourceDefinition' => 'Phobject', 'NuanceSourceEditController' => 'NuanceController', @@ -3881,10 +3867,9 @@ phutil_register_library_map(array( 'PackageModifyMail' => 'PackageMail', 'PassphraseAbstractKey' => 'Phobject', 'PassphraseController' => 'PhabricatorController', - 'PassphraseCredential' => - array( - 0 => 'PassphraseDAO', - 1 => 'PhabricatorPolicyInterface', + 'PassphraseCredential' => array( + 'PassphraseDAO', + 'PhabricatorPolicyInterface', ), 'PassphraseCredentialControl' => 'AphrontFormControl', 'PassphraseCredentialCreateController' => 'PassphraseController', @@ -3951,6 +3936,7 @@ phutil_register_library_map(array( 'PhabricatorApplicationCountdown' => 'PhabricatorApplication', 'PhabricatorApplicationDaemons' => 'PhabricatorApplication', 'PhabricatorApplicationDashboard' => 'PhabricatorApplication', + 'PhabricatorApplicationDatasource' => 'PhabricatorTypeaheadDatasource', 'PhabricatorApplicationDetailViewController' => 'PhabricatorApplicationsController', 'PhabricatorApplicationDifferential' => 'PhabricatorApplication', 'PhabricatorApplicationDiffusion' => 'PhabricatorApplication', @@ -4006,18 +3992,16 @@ phutil_register_library_map(array( 'PhabricatorApplicationSystem' => 'PhabricatorApplication', 'PhabricatorApplicationTest' => 'PhabricatorApplication', 'PhabricatorApplicationTokens' => 'PhabricatorApplication', - 'PhabricatorApplicationTransaction' => - array( - 0 => 'PhabricatorLiskDAO', - 1 => 'PhabricatorPolicyInterface', - 2 => 'PhabricatorDestructableInterface', + 'PhabricatorApplicationTransaction' => array( + 'PhabricatorLiskDAO', + 'PhabricatorPolicyInterface', + 'PhabricatorDestructibleInterface', ), - 'PhabricatorApplicationTransactionComment' => - array( - 0 => 'PhabricatorLiskDAO', - 1 => 'PhabricatorMarkupInterface', - 2 => 'PhabricatorPolicyInterface', - 3 => 'PhabricatorDestructableInterface', + 'PhabricatorApplicationTransactionComment' => array( + 'PhabricatorLiskDAO', + 'PhabricatorMarkupInterface', + 'PhabricatorPolicyInterface', + 'PhabricatorDestructibleInterface', ), 'PhabricatorApplicationTransactionCommentEditController' => 'PhabricatorApplicationTransactionController', 'PhabricatorApplicationTransactionCommentEditor' => 'PhabricatorEditor', @@ -4050,18 +4034,16 @@ phutil_register_library_map(array( 'PhabricatorApplicationsListController' => 'PhabricatorApplicationsController', 'PhabricatorAsanaConfigOptions' => 'PhabricatorApplicationConfigOptions', 'PhabricatorAuditAddCommentController' => 'PhabricatorAuditController', - 'PhabricatorAuditComment' => - array( - 0 => 'PhabricatorAuditDAO', - 1 => 'PhabricatorMarkupInterface', + 'PhabricatorAuditComment' => array( + 'PhabricatorAuditDAO', + 'PhabricatorMarkupInterface', ), 'PhabricatorAuditCommentEditor' => 'PhabricatorEditor', 'PhabricatorAuditController' => 'PhabricatorController', 'PhabricatorAuditDAO' => 'PhabricatorLiskDAO', - 'PhabricatorAuditInlineComment' => - array( - 0 => 'PhabricatorAuditDAO', - 1 => 'PhabricatorInlineCommentInterface', + 'PhabricatorAuditInlineComment' => array( + 'PhabricatorAuditDAO', + 'PhabricatorInlineCommentInterface', ), 'PhabricatorAuditListController' => 'PhabricatorAuditController', 'PhabricatorAuditListView' => 'AphrontView', @@ -4098,10 +4080,9 @@ phutil_register_library_map(array( 'PhabricatorAuthOldOAuthRedirectController' => 'PhabricatorAuthController', 'PhabricatorAuthOneTimeLoginController' => 'PhabricatorAuthController', 'PhabricatorAuthPHIDTypeAuthFactor' => 'PhabricatorPHIDType', - 'PhabricatorAuthProviderConfig' => - array( - 0 => 'PhabricatorAuthDAO', - 1 => 'PhabricatorPolicyInterface', + 'PhabricatorAuthProviderConfig' => array( + 'PhabricatorAuthDAO', + 'PhabricatorPolicyInterface', ), 'PhabricatorAuthProviderConfigController' => 'PhabricatorAuthController', 'PhabricatorAuthProviderConfigEditor' => 'PhabricatorApplicationTransactionEditor', @@ -4126,19 +4107,17 @@ phutil_register_library_map(array( 'PhabricatorAuthProviderPassword' => 'PhabricatorAuthProvider', 'PhabricatorAuthProviderPersona' => 'PhabricatorAuthProvider', 'PhabricatorAuthRegisterController' => 'PhabricatorAuthController', - 'PhabricatorAuthSession' => - array( - 0 => 'PhabricatorAuthDAO', - 1 => 'PhabricatorPolicyInterface', + 'PhabricatorAuthSession' => array( + 'PhabricatorAuthDAO', + 'PhabricatorPolicyInterface', ), 'PhabricatorAuthSessionEngine' => 'Phobject', 'PhabricatorAuthSessionGarbageCollector' => 'PhabricatorGarbageCollector', 'PhabricatorAuthSessionQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', 'PhabricatorAuthStartController' => 'PhabricatorAuthController', - 'PhabricatorAuthTemporaryToken' => - array( - 0 => 'PhabricatorAuthDAO', - 1 => 'PhabricatorPolicyInterface', + 'PhabricatorAuthTemporaryToken' => array( + 'PhabricatorAuthDAO', + 'PhabricatorPolicyInterface', ), 'PhabricatorAuthTemporaryTokenGarbageCollector' => 'PhabricatorGarbageCollector', 'PhabricatorAuthTemporaryTokenQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', @@ -4176,10 +4155,9 @@ phutil_register_library_map(array( 'PhabricatorCalendarBrowseController' => 'PhabricatorCalendarController', 'PhabricatorCalendarController' => 'PhabricatorController', 'PhabricatorCalendarDAO' => 'PhabricatorLiskDAO', - 'PhabricatorCalendarEvent' => - array( - 0 => 'PhabricatorCalendarDAO', - 1 => 'PhabricatorPolicyInterface', + 'PhabricatorCalendarEvent' => array( + 'PhabricatorCalendarDAO', + 'PhabricatorPolicyInterface', ), 'PhabricatorCalendarEventDeleteController' => 'PhabricatorCalendarController', 'PhabricatorCalendarEventEditController' => 'PhabricatorCalendarController', @@ -4195,20 +4173,18 @@ phutil_register_library_map(array( 'PhabricatorCampfireProtocolAdapter' => 'PhabricatorBotBaseStreamingProtocolAdapter', 'PhabricatorChangeParserTestCase' => 'PhabricatorWorkingCopyTestCase', 'PhabricatorChangesetResponse' => 'AphrontProxyResponse', - 'PhabricatorChatLogChannel' => - array( - 0 => 'PhabricatorChatLogDAO', - 1 => 'PhabricatorPolicyInterface', + 'PhabricatorChatLogChannel' => array( + 'PhabricatorChatLogDAO', + 'PhabricatorPolicyInterface', ), 'PhabricatorChatLogChannelListController' => 'PhabricatorChatLogController', 'PhabricatorChatLogChannelLogController' => 'PhabricatorChatLogController', 'PhabricatorChatLogChannelQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', 'PhabricatorChatLogController' => 'PhabricatorController', 'PhabricatorChatLogDAO' => 'PhabricatorLiskDAO', - 'PhabricatorChatLogEvent' => - array( - 0 => 'PhabricatorChatLogDAO', - 1 => 'PhabricatorPolicyInterface', + 'PhabricatorChatLogEvent' => array( + 'PhabricatorChatLogDAO', + 'PhabricatorPolicyInterface', ), 'PhabricatorChatLogEventType' => 'PhabricatorChatLogConstants', 'PhabricatorChatLogQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', @@ -4227,10 +4203,9 @@ phutil_register_library_map(array( 'PhabricatorConduitListController' => 'PhabricatorConduitController', 'PhabricatorConduitLogController' => 'PhabricatorConduitController', 'PhabricatorConduitLogQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', - 'PhabricatorConduitMethodCallLog' => - array( - 0 => 'PhabricatorConduitDAO', - 1 => 'PhabricatorPolicyInterface', + 'PhabricatorConduitMethodCallLog' => array( + 'PhabricatorConduitDAO', + 'PhabricatorPolicyInterface', ), 'PhabricatorConduitMethodQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', 'PhabricatorConduitSearchEngine' => 'PhabricatorApplicationSearchEngine', @@ -4242,10 +4217,9 @@ phutil_register_library_map(array( 'PhabricatorConfigDictionarySource' => 'PhabricatorConfigSource', 'PhabricatorConfigEditController' => 'PhabricatorConfigController', 'PhabricatorConfigEditor' => 'PhabricatorApplicationTransactionEditor', - 'PhabricatorConfigEntry' => - array( - 0 => 'PhabricatorConfigEntryDAO', - 1 => 'PhabricatorPolicyInterface', + 'PhabricatorConfigEntry' => array( + 'PhabricatorConfigEntryDAO', + 'PhabricatorPolicyInterface', ), 'PhabricatorConfigEntryDAO' => 'PhabricatorLiskDAO', 'PhabricatorConfigEntryQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', @@ -4262,10 +4236,9 @@ phutil_register_library_map(array( 'PhabricatorConfigManagementListWorkflow' => 'PhabricatorConfigManagementWorkflow', 'PhabricatorConfigManagementSetWorkflow' => 'PhabricatorConfigManagementWorkflow', 'PhabricatorConfigManagementWorkflow' => 'PhabricatorManagementWorkflow', - 'PhabricatorConfigOption' => - array( - 0 => 'Phobject', - 1 => 'PhabricatorMarkupInterface', + 'PhabricatorConfigOption' => array( + 'Phobject', + 'PhabricatorMarkupInterface', ), 'PhabricatorConfigPHIDTypeConfig' => 'PhabricatorPHIDType', 'PhabricatorConfigProxySource' => 'PhabricatorConfigSource', @@ -4280,10 +4253,9 @@ phutil_register_library_map(array( 'PhabricatorController' => 'AphrontController', 'PhabricatorCookies' => 'Phobject', 'PhabricatorCoreConfigOptions' => 'PhabricatorApplicationConfigOptions', - 'PhabricatorCountdown' => - array( - 0 => 'PhabricatorCountdownDAO', - 1 => 'PhabricatorPolicyInterface', + 'PhabricatorCountdown' => array( + 'PhabricatorCountdownDAO', + 'PhabricatorPolicyInterface', ), 'PhabricatorCountdownCapabilityDefaultView' => 'PhabricatorPolicyCapability', 'PhabricatorCountdownController' => 'PhabricatorController', @@ -4317,10 +4289,9 @@ phutil_register_library_map(array( 'PhabricatorDaemonController' => 'PhabricatorController', 'PhabricatorDaemonDAO' => 'PhabricatorLiskDAO', 'PhabricatorDaemonEventListener' => 'PhabricatorEventListener', - 'PhabricatorDaemonLog' => - array( - 0 => 'PhabricatorDaemonDAO', - 1 => 'PhabricatorPolicyInterface', + 'PhabricatorDaemonLog' => array( + 'PhabricatorDaemonDAO', + 'PhabricatorPolicyInterface', ), 'PhabricatorDaemonLogEvent' => 'PhabricatorDaemonDAO', 'PhabricatorDaemonLogEventGarbageCollector' => 'PhabricatorGarbageCollector', @@ -4341,10 +4312,9 @@ phutil_register_library_map(array( 'PhabricatorDaemonManagementStopWorkflow' => 'PhabricatorDaemonManagementWorkflow', 'PhabricatorDaemonManagementWorkflow' => 'PhabricatorManagementWorkflow', 'PhabricatorDaemonTaskGarbageCollector' => 'PhabricatorGarbageCollector', - 'PhabricatorDashboard' => - array( - 0 => 'PhabricatorDashboardDAO', - 1 => 'PhabricatorPolicyInterface', + 'PhabricatorDashboard' => array( + 'PhabricatorDashboardDAO', + 'PhabricatorPolicyInterface', ), 'PhabricatorDashboardAddPanelController' => 'PhabricatorDashboardController', 'PhabricatorDashboardController' => 'PhabricatorController', @@ -4359,17 +4329,15 @@ phutil_register_library_map(array( 'PhabricatorDashboardMovePanelController' => 'PhabricatorDashboardController', 'PhabricatorDashboardPHIDTypeDashboard' => 'PhabricatorPHIDType', 'PhabricatorDashboardPHIDTypePanel' => 'PhabricatorPHIDType', - 'PhabricatorDashboardPanel' => - array( - 0 => 'PhabricatorDashboardDAO', - 1 => 'PhabricatorPolicyInterface', - 2 => 'PhabricatorCustomFieldInterface', + 'PhabricatorDashboardPanel' => array( + 'PhabricatorDashboardDAO', + 'PhabricatorPolicyInterface', + 'PhabricatorCustomFieldInterface', ), 'PhabricatorDashboardPanelArchiveController' => 'PhabricatorDashboardController', - 'PhabricatorDashboardPanelCoreCustomField' => - array( - 0 => 'PhabricatorDashboardPanelCustomField', - 1 => 'PhabricatorStandardCustomFieldInterface', + 'PhabricatorDashboardPanelCoreCustomField' => array( + 'PhabricatorDashboardPanelCustomField', + 'PhabricatorStandardCustomFieldInterface', ), 'PhabricatorDashboardPanelCustomField' => 'PhabricatorCustomField', 'PhabricatorDashboardPanelEditController' => 'PhabricatorDashboardController', @@ -4414,10 +4382,11 @@ phutil_register_library_map(array( 'PhabricatorDraftDAO' => 'PhabricatorLiskDAO', 'PhabricatorEdgeConfig' => 'PhabricatorEdgeConstants', 'PhabricatorEdgeCycleException' => 'Exception', - 'PhabricatorEdgeEditor' => 'PhabricatorEditor', + 'PhabricatorEdgeEditor' => 'Phobject', 'PhabricatorEdgeGraph' => 'AbstractDirectedGraph', 'PhabricatorEdgeQuery' => 'PhabricatorQuery', 'PhabricatorEdgeTestCase' => 'PhabricatorTestCase', + 'PhabricatorEdgeType' => 'Phobject', 'PhabricatorEditor' => 'Phobject', 'PhabricatorEmailLoginController' => 'PhabricatorAuthController', 'PhabricatorEmailVerificationController' => 'PhabricatorAuthController', @@ -4430,10 +4399,9 @@ phutil_register_library_map(array( 'PhabricatorEventType' => 'PhutilEventType', 'PhabricatorExampleEventListener' => 'PhabricatorEventListener', 'PhabricatorExtendingPhabricatorConfigOptions' => 'PhabricatorApplicationConfigOptions', - 'PhabricatorExternalAccount' => - array( - 0 => 'PhabricatorUserDAO', - 1 => 'PhabricatorPolicyInterface', + 'PhabricatorExternalAccount' => array( + 'PhabricatorUserDAO', + 'PhabricatorPolicyInterface', ), 'PhabricatorExternalAccountQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', 'PhabricatorFactAggregate' => 'PhabricatorFactDAO', @@ -4477,13 +4445,12 @@ phutil_register_library_map(array( 'PhabricatorFeedStoryReference' => 'PhabricatorFeedDAO', 'PhabricatorFeedStoryStatus' => 'PhabricatorFeedStory', 'PhabricatorFeedStoryTypeConstants' => 'PhabricatorFeedConstants', - 'PhabricatorFile' => - array( - 0 => 'PhabricatorFileDAO', - 1 => 'PhabricatorTokenReceiverInterface', - 2 => 'PhabricatorSubscribableInterface', - 3 => 'PhabricatorFlaggableInterface', - 4 => 'PhabricatorPolicyInterface', + 'PhabricatorFile' => array( + 'PhabricatorFileDAO', + 'PhabricatorTokenReceiverInterface', + 'PhabricatorSubscribableInterface', + 'PhabricatorFlaggableInterface', + 'PhabricatorPolicyInterface', ), 'PhabricatorFileCommentController' => 'PhabricatorFileController', 'PhabricatorFileComposeController' => 'PhabricatorFileController', @@ -4493,13 +4460,12 @@ phutil_register_library_map(array( 'PhabricatorFileDeleteController' => 'PhabricatorFileController', 'PhabricatorFileDropUploadController' => 'PhabricatorFileController', 'PhabricatorFileEditor' => 'PhabricatorApplicationTransactionEditor', - 'PhabricatorFileImageMacro' => - array( - 0 => 'PhabricatorFileDAO', - 1 => 'PhabricatorSubscribableInterface', - 2 => 'PhabricatorApplicationTransactionInterface', - 3 => 'PhabricatorFlaggableInterface', - 4 => 'PhabricatorPolicyInterface', + 'PhabricatorFileImageMacro' => array( + 'PhabricatorFileDAO', + 'PhabricatorSubscribableInterface', + 'PhabricatorApplicationTransactionInterface', + 'PhabricatorFlaggableInterface', + 'PhabricatorPolicyInterface', ), 'PhabricatorFileInfoController' => 'PhabricatorFileController', 'PhabricatorFileLinkListView' => 'AphrontView', @@ -4527,10 +4493,9 @@ phutil_register_library_map(array( 'PhabricatorFilesManagementPurgeWorkflow' => 'PhabricatorFilesManagementWorkflow', 'PhabricatorFilesManagementRebuildWorkflow' => 'PhabricatorFilesManagementWorkflow', 'PhabricatorFilesManagementWorkflow' => 'PhabricatorManagementWorkflow', - 'PhabricatorFlag' => - array( - 0 => 'PhabricatorFlagDAO', - 1 => 'PhabricatorPolicyInterface', + 'PhabricatorFlag' => array( + 'PhabricatorFlagDAO', + 'PhabricatorPolicyInterface', ), 'PhabricatorFlagColor' => 'PhabricatorFlagConstants', 'PhabricatorFlagController' => 'PhabricatorController', @@ -4575,6 +4540,7 @@ phutil_register_library_map(array( 'PhabricatorIteratedMD5PasswordHasher' => 'PhabricatorPasswordHasher', 'PhabricatorJavelinLinter' => 'ArcanistLinter', 'PhabricatorKeyValueDatabaseCache' => 'PhutilKeyValueCache', + 'PhabricatorLegacyEdgeType' => 'PhabricatorEdgeType', 'PhabricatorLegalpadConfigOptions' => 'PhabricatorApplicationConfigOptions', 'PhabricatorLegalpadPHIDTypeDocument' => 'PhabricatorPHIDType', 'PhabricatorLipsumGenerateWorkflow' => 'PhabricatorLipsumManagementWorkflow', @@ -4621,6 +4587,7 @@ phutil_register_library_map(array( 'PhabricatorMailManagementWorkflow' => 'PhabricatorManagementWorkflow', 'PhabricatorMailReceiverTestCase' => 'PhabricatorTestCase', 'PhabricatorMailgunConfigOptions' => 'PhabricatorApplicationConfigOptions', + 'PhabricatorMailingListDatasource' => 'PhabricatorTypeaheadDatasource', 'PhabricatorMailingListPHIDTypeList' => 'PhabricatorPHIDType', 'PhabricatorMailingListQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', 'PhabricatorMailingListSearchEngine' => 'PhabricatorApplicationSearchEngine', @@ -4647,11 +4614,12 @@ phutil_register_library_map(array( 'PhabricatorMetaMTAMail' => 'PhabricatorMetaMTADAO', 'PhabricatorMetaMTAMailBodyTestCase' => 'PhabricatorTestCase', 'PhabricatorMetaMTAMailTestCase' => 'PhabricatorTestCase', + 'PhabricatorMetaMTAMailableDatasource' => 'PhabricatorTypeaheadCompositeDatasource', 'PhabricatorMetaMTAMailgunReceiveController' => 'PhabricatorMetaMTAController', - 'PhabricatorMetaMTAMailingList' => - array( - 0 => 'PhabricatorMetaMTADAO', - 1 => 'PhabricatorPolicyInterface', + 'PhabricatorMetaMTAMailingList' => array( + 'PhabricatorMetaMTADAO', + 'PhabricatorPolicyInterface', + 'PhabricatorDestructibleInterface', ), 'PhabricatorMetaMTAMemberQuery' => 'PhabricatorQuery', 'PhabricatorMetaMTAPermanentFailureException' => 'Exception', @@ -4664,10 +4632,9 @@ phutil_register_library_map(array( 'PhabricatorMustVerifyEmailController' => 'PhabricatorAuthController', 'PhabricatorMySQLConfigOptions' => 'PhabricatorApplicationConfigOptions', 'PhabricatorMySQLFileStorageEngine' => 'PhabricatorFileStorageEngine', - 'PhabricatorNamedQuery' => - array( - 0 => 'PhabricatorSearchDAO', - 1 => 'PhabricatorPolicyInterface', + 'PhabricatorNamedQuery' => array( + 'PhabricatorSearchDAO', + 'PhabricatorPolicyInterface', ), 'PhabricatorNamedQueryQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', 'PhabricatorNotificationAdHocFeedStory' => 'PhabricatorFeedStory', @@ -4681,27 +4648,25 @@ phutil_register_library_map(array( 'PhabricatorNotificationStatusController' => 'PhabricatorNotificationController', 'PhabricatorNotificationStatusView' => 'AphrontTagView', 'PhabricatorNotificationTestController' => 'PhabricatorNotificationController', - 'PhabricatorOAuthClientAuthorization' => - array( - 0 => 'PhabricatorOAuthServerDAO', - 1 => 'PhabricatorPolicyInterface', + 'PhabricatorOAuthClientAuthorization' => array( + 'PhabricatorOAuthServerDAO', + 'PhabricatorPolicyInterface', ), 'PhabricatorOAuthClientAuthorizationQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', - 'PhabricatorOAuthClientBaseController' => 'PhabricatorOAuthServerController', - 'PhabricatorOAuthClientDeleteController' => 'PhabricatorOAuthClientBaseController', - 'PhabricatorOAuthClientEditController' => 'PhabricatorOAuthClientBaseController', - 'PhabricatorOAuthClientListController' => 'PhabricatorOAuthClientBaseController', - 'PhabricatorOAuthClientViewController' => 'PhabricatorOAuthClientBaseController', + 'PhabricatorOAuthClientController' => 'PhabricatorOAuthServerController', + 'PhabricatorOAuthClientDeleteController' => 'PhabricatorOAuthClientController', + 'PhabricatorOAuthClientEditController' => 'PhabricatorOAuthClientController', + 'PhabricatorOAuthClientListController' => 'PhabricatorOAuthClientController', + 'PhabricatorOAuthClientViewController' => 'PhabricatorOAuthClientController', 'PhabricatorOAuthResponse' => 'AphrontResponse', 'PhabricatorOAuthServerAccessToken' => 'PhabricatorOAuthServerDAO', 'PhabricatorOAuthServerAuthController' => 'PhabricatorAuthController', 'PhabricatorOAuthServerAuthorizationCode' => 'PhabricatorOAuthServerDAO', 'PhabricatorOAuthServerAuthorizationsSettingsPanel' => 'PhabricatorSettingsPanel', 'PhabricatorOAuthServerCapabilityCreateClients' => 'PhabricatorPolicyCapability', - 'PhabricatorOAuthServerClient' => - array( - 0 => 'PhabricatorOAuthServerDAO', - 1 => 'PhabricatorPolicyInterface', + 'PhabricatorOAuthServerClient' => array( + 'PhabricatorOAuthServerDAO', + 'PhabricatorPolicyInterface', ), 'PhabricatorOAuthServerClientQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', 'PhabricatorOAuthServerClientSearchEngine' => 'PhabricatorApplicationSearchEngine', @@ -4728,10 +4693,9 @@ phutil_register_library_map(array( 'PhabricatorOwnersListController' => 'PhabricatorOwnersController', 'PhabricatorOwnersOwner' => 'PhabricatorOwnersDAO', 'PhabricatorOwnersPHIDTypePackage' => 'PhabricatorPHIDType', - 'PhabricatorOwnersPackage' => - array( - 0 => 'PhabricatorOwnersDAO', - 1 => 'PhabricatorPolicyInterface', + 'PhabricatorOwnersPackage' => array( + 'PhabricatorOwnersDAO', + 'PhabricatorPolicyInterface', ), 'PhabricatorOwnersPackageDatasource' => 'PhabricatorTypeaheadDatasource', 'PhabricatorOwnersPackageQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', @@ -4743,14 +4707,13 @@ phutil_register_library_map(array( 'PhabricatorPasswordHasher' => 'Phobject', 'PhabricatorPasswordHasherTestCase' => 'PhabricatorTestCase', 'PhabricatorPasswordHasherUnavailableException' => 'Exception', - 'PhabricatorPaste' => - array( - 0 => 'PhabricatorPasteDAO', - 1 => 'PhabricatorSubscribableInterface', - 2 => 'PhabricatorTokenReceiverInterface', - 3 => 'PhabricatorFlaggableInterface', - 4 => 'PhabricatorPolicyInterface', - 5 => 'PhabricatorProjectInterface', + 'PhabricatorPaste' => array( + 'PhabricatorPasteDAO', + 'PhabricatorSubscribableInterface', + 'PhabricatorTokenReceiverInterface', + 'PhabricatorFlaggableInterface', + 'PhabricatorPolicyInterface', + 'PhabricatorProjectInterface', ), 'PhabricatorPasteCommentController' => 'PhabricatorPasteController', 'PhabricatorPasteConfigOptions' => 'PhabricatorApplicationConfigOptions', @@ -4772,6 +4735,7 @@ phutil_register_library_map(array( 'PhabricatorPeopleCalendarController' => 'PhabricatorPeopleController', 'PhabricatorPeopleController' => 'PhabricatorController', 'PhabricatorPeopleCreateController' => 'PhabricatorPeopleController', + 'PhabricatorPeopleDatasource' => 'PhabricatorTypeaheadDatasource', 'PhabricatorPeopleDeleteController' => 'PhabricatorPeopleController', 'PhabricatorPeopleDisableController' => 'PhabricatorPeopleController', 'PhabricatorPeopleEmpowerController' => 'PhabricatorPeopleController', @@ -4801,10 +4765,9 @@ phutil_register_library_map(array( 'PhabricatorPhrequentConfigOptions' => 'PhabricatorApplicationConfigOptions', 'PhabricatorPhrictionConfigOptions' => 'PhabricatorApplicationConfigOptions', 'PhabricatorPolicies' => 'PhabricatorPolicyConstants', - 'PhabricatorPolicy' => - array( - 0 => 'PhabricatorPolicyDAO', - 1 => 'PhabricatorPolicyInterface', + 'PhabricatorPolicy' => array( + 'PhabricatorPolicyDAO', + 'PhabricatorPolicyInterface', ), 'PhabricatorPolicyAwareQuery' => 'PhabricatorOffsetPagedQuery', 'PhabricatorPolicyAwareTestQuery' => 'PhabricatorPolicyAwareQuery', @@ -4833,14 +4796,13 @@ phutil_register_library_map(array( 'PhabricatorPolicyTestCase' => 'PhabricatorTestCase', 'PhabricatorPolicyTestObject' => 'PhabricatorPolicyInterface', 'PhabricatorPolicyType' => 'PhabricatorPolicyConstants', - 'PhabricatorProject' => - array( - 0 => 'PhabricatorProjectDAO', - 1 => 'PhabricatorFlaggableInterface', - 2 => 'PhabricatorPolicyInterface', - 3 => 'PhabricatorSubscribableInterface', - 4 => 'PhabricatorCustomFieldInterface', - 5 => 'PhabricatorDestructableInterface', + 'PhabricatorProject' => array( + 'PhabricatorProjectDAO', + 'PhabricatorFlaggableInterface', + 'PhabricatorPolicyInterface', + 'PhabricatorSubscribableInterface', + 'PhabricatorCustomFieldInterface', + 'PhabricatorDestructibleInterface', ), 'PhabricatorProjectArchiveController' => 'PhabricatorProjectController', 'PhabricatorProjectBoardController' => 'PhabricatorProjectController', @@ -4848,11 +4810,10 @@ phutil_register_library_map(array( 'PhabricatorProjectBoardEditController' => 'PhabricatorProjectBoardController', 'PhabricatorProjectBoardReorderController' => 'PhabricatorProjectBoardController', 'PhabricatorProjectBoardViewController' => 'PhabricatorProjectBoardController', - 'PhabricatorProjectColumn' => - array( - 0 => 'PhabricatorProjectDAO', - 1 => 'PhabricatorPolicyInterface', - 2 => 'PhabricatorDestructableInterface', + 'PhabricatorProjectColumn' => array( + 'PhabricatorProjectDAO', + 'PhabricatorPolicyInterface', + 'PhabricatorDestructibleInterface', ), 'PhabricatorProjectColumnDetailController' => 'PhabricatorProjectBoardController', 'PhabricatorProjectColumnQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', @@ -4860,10 +4821,9 @@ phutil_register_library_map(array( 'PhabricatorProjectColumnTransactionEditor' => 'PhabricatorApplicationTransactionEditor', 'PhabricatorProjectColumnTransactionQuery' => 'PhabricatorApplicationTransactionQuery', 'PhabricatorProjectConfigOptions' => 'PhabricatorApplicationConfigOptions', - 'PhabricatorProjectConfiguredCustomField' => - array( - 0 => 'PhabricatorProjectStandardCustomField', - 1 => 'PhabricatorStandardCustomFieldInterface', + 'PhabricatorProjectConfiguredCustomField' => array( + 'PhabricatorProjectStandardCustomField', + 'PhabricatorStandardCustomFieldInterface', ), 'PhabricatorProjectController' => 'PhabricatorController', 'PhabricatorProjectCreateController' => 'PhabricatorProjectController', @@ -4885,17 +4845,19 @@ phutil_register_library_map(array( 'PhabricatorProjectMembersRemoveController' => 'PhabricatorProjectController', 'PhabricatorProjectMoveController' => 'PhabricatorProjectController', 'PhabricatorProjectNameCollisionException' => 'Exception', + 'PhabricatorProjectObjectHasProjectEdgeType' => 'PhabricatorEdgeType', + 'PhabricatorProjectOrUserDatasource' => 'PhabricatorTypeaheadCompositeDatasource', 'PhabricatorProjectPHIDTypeColumn' => 'PhabricatorPHIDType', 'PhabricatorProjectPHIDTypeProject' => 'PhabricatorPHIDType', 'PhabricatorProjectProfileController' => 'PhabricatorProjectController', + 'PhabricatorProjectProjectHasObjectEdgeType' => 'PhabricatorEdgeType', 'PhabricatorProjectQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', 'PhabricatorProjectSearchEngine' => 'PhabricatorApplicationSearchEngine', 'PhabricatorProjectSearchIndexer' => 'PhabricatorSearchDocumentIndexer', 'PhabricatorProjectSlug' => 'PhabricatorProjectDAO', - 'PhabricatorProjectStandardCustomField' => - array( - 0 => 'PhabricatorProjectCustomField', - 1 => 'PhabricatorStandardCustomFieldInterface', + 'PhabricatorProjectStandardCustomField' => array( + 'PhabricatorProjectCustomField', + 'PhabricatorStandardCustomFieldInterface', ), 'PhabricatorProjectTestDataGenerator' => 'PhabricatorTestDataGenerator', 'PhabricatorProjectTransaction' => 'PhabricatorApplicationTransaction', @@ -4922,38 +4884,34 @@ phutil_register_library_map(array( 'PhabricatorRemarkupRuleMention' => 'PhutilRemarkupRule', 'PhabricatorRemarkupRuleObject' => 'PhutilRemarkupRule', 'PhabricatorRemarkupRuleYoutube' => 'PhutilRemarkupRule', - 'PhabricatorRepository' => - array( - 0 => 'PhabricatorRepositoryDAO', - 1 => 'PhabricatorPolicyInterface', - 2 => 'PhabricatorFlaggableInterface', - 3 => 'PhabricatorMarkupInterface', - 4 => 'PhabricatorDestructableInterface', - 5 => 'PhabricatorProjectInterface', + 'PhabricatorRepository' => array( + 'PhabricatorRepositoryDAO', + 'PhabricatorPolicyInterface', + 'PhabricatorFlaggableInterface', + 'PhabricatorMarkupInterface', + 'PhabricatorDestructibleInterface', + 'PhabricatorProjectInterface', ), - 'PhabricatorRepositoryArcanistProject' => - array( - 0 => 'PhabricatorRepositoryDAO', - 1 => 'PhabricatorPolicyInterface', - 2 => 'PhabricatorDestructableInterface', + 'PhabricatorRepositoryArcanistProject' => array( + 'PhabricatorRepositoryDAO', + 'PhabricatorPolicyInterface', + 'PhabricatorDestructibleInterface', ), 'PhabricatorRepositoryArcanistProjectDeleteController' => 'PhabricatorRepositoryController', 'PhabricatorRepositoryArcanistProjectEditController' => 'PhabricatorRepositoryController', 'PhabricatorRepositoryArcanistProjectQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', - 'PhabricatorRepositoryAuditRequest' => - array( - 0 => 'PhabricatorRepositoryDAO', - 1 => 'PhabricatorPolicyInterface', + 'PhabricatorRepositoryAuditRequest' => array( + 'PhabricatorRepositoryDAO', + 'PhabricatorPolicyInterface', ), 'PhabricatorRepositoryBranch' => 'PhabricatorRepositoryDAO', - 'PhabricatorRepositoryCommit' => - array( - 0 => 'PhabricatorRepositoryDAO', - 1 => 'PhabricatorPolicyInterface', - 2 => 'PhabricatorFlaggableInterface', - 3 => 'PhabricatorTokenReceiverInterface', - 4 => 'HarbormasterBuildableInterface', - 5 => 'PhabricatorCustomFieldInterface', + 'PhabricatorRepositoryCommit' => array( + 'PhabricatorRepositoryDAO', + 'PhabricatorPolicyInterface', + 'PhabricatorFlaggableInterface', + 'PhabricatorTokenReceiverInterface', + 'HarbormasterBuildableInterface', + 'PhabricatorCustomFieldInterface', ), 'PhabricatorRepositoryCommitChangeParserWorker' => 'PhabricatorRepositoryCommitParserWorker', 'PhabricatorRepositoryCommitData' => 'PhabricatorRepositoryDAO', @@ -4986,10 +4944,9 @@ phutil_register_library_map(array( 'PhabricatorRepositoryManagementWorkflow' => 'PhabricatorManagementWorkflow', 'PhabricatorRepositoryMercurialCommitChangeParserWorker' => 'PhabricatorRepositoryCommitChangeParserWorker', 'PhabricatorRepositoryMercurialCommitMessageParserWorker' => 'PhabricatorRepositoryCommitMessageParserWorker', - 'PhabricatorRepositoryMirror' => - array( - 0 => 'PhabricatorRepositoryDAO', - 1 => 'PhabricatorPolicyInterface', + 'PhabricatorRepositoryMirror' => array( + 'PhabricatorRepositoryDAO', + 'PhabricatorPolicyInterface', ), 'PhabricatorRepositoryMirrorEngine' => 'PhabricatorRepositoryEngine', 'PhabricatorRepositoryMirrorQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', @@ -5002,26 +4959,23 @@ phutil_register_library_map(array( 'PhabricatorRepositoryParsedChange' => 'Phobject', 'PhabricatorRepositoryPullEngine' => 'PhabricatorRepositoryEngine', 'PhabricatorRepositoryPullLocalDaemon' => 'PhabricatorDaemon', - 'PhabricatorRepositoryPushEvent' => - array( - 0 => 'PhabricatorRepositoryDAO', - 1 => 'PhabricatorPolicyInterface', + 'PhabricatorRepositoryPushEvent' => array( + 'PhabricatorRepositoryDAO', + 'PhabricatorPolicyInterface', ), 'PhabricatorRepositoryPushEventQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', - 'PhabricatorRepositoryPushLog' => - array( - 0 => 'PhabricatorRepositoryDAO', - 1 => 'PhabricatorPolicyInterface', + 'PhabricatorRepositoryPushLog' => array( + 'PhabricatorRepositoryDAO', + 'PhabricatorPolicyInterface', ), 'PhabricatorRepositoryPushLogQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', 'PhabricatorRepositoryPushLogSearchEngine' => 'PhabricatorApplicationSearchEngine', 'PhabricatorRepositoryPushMailWorker' => 'PhabricatorWorker', 'PhabricatorRepositoryPushReplyHandler' => 'PhabricatorMailReplyHandler', 'PhabricatorRepositoryQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', - 'PhabricatorRepositoryRefCursor' => - array( - 0 => 'PhabricatorRepositoryDAO', - 1 => 'PhabricatorPolicyInterface', + 'PhabricatorRepositoryRefCursor' => array( + 'PhabricatorRepositoryDAO', + 'PhabricatorPolicyInterface', ), 'PhabricatorRepositoryRefCursorQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', 'PhabricatorRepositoryRefEngine' => 'PhabricatorRepositoryEngine', @@ -5055,10 +5009,9 @@ phutil_register_library_map(array( 'PhabricatorSSHLog' => 'Phobject', 'PhabricatorSSHPassthruCommand' => 'Phobject', 'PhabricatorSSHWorkflow' => 'PhabricatorManagementWorkflow', - 'PhabricatorSavedQuery' => - array( - 0 => 'PhabricatorSearchDAO', - 1 => 'PhabricatorPolicyInterface', + 'PhabricatorSavedQuery' => array( + 'PhabricatorSearchDAO', + 'PhabricatorPolicyInterface', ), 'PhabricatorSavedQueryQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', 'PhabricatorSearchApplicationSearchEngine' => 'PhabricatorApplicationSearchEngine', @@ -5067,6 +5020,7 @@ phutil_register_library_map(array( 'PhabricatorSearchConfigOptions' => 'PhabricatorApplicationConfigOptions', 'PhabricatorSearchController' => 'PhabricatorSearchBaseController', 'PhabricatorSearchDAO' => 'PhabricatorLiskDAO', + 'PhabricatorSearchDatasource' => 'PhabricatorTypeaheadCompositeDatasource', 'PhabricatorSearchDeleteController' => 'PhabricatorSearchBaseController', 'PhabricatorSearchDocument' => 'PhabricatorSearchDAO', 'PhabricatorSearchDocumentField' => 'PhabricatorSearchDAO', @@ -5140,14 +5094,13 @@ phutil_register_library_map(array( 'PhabricatorSlowvoteListController' => 'PhabricatorSlowvoteController', 'PhabricatorSlowvoteOption' => 'PhabricatorSlowvoteDAO', 'PhabricatorSlowvotePHIDTypePoll' => 'PhabricatorPHIDType', - 'PhabricatorSlowvotePoll' => - array( - 0 => 'PhabricatorSlowvoteDAO', - 1 => 'PhabricatorPolicyInterface', - 2 => 'PhabricatorSubscribableInterface', - 3 => 'PhabricatorFlaggableInterface', - 4 => 'PhabricatorTokenReceiverInterface', - 5 => 'PhabricatorProjectInterface', + 'PhabricatorSlowvotePoll' => array( + 'PhabricatorSlowvoteDAO', + 'PhabricatorPolicyInterface', + 'PhabricatorSubscribableInterface', + 'PhabricatorFlaggableInterface', + 'PhabricatorTokenReceiverInterface', + 'PhabricatorProjectInterface', ), 'PhabricatorSlowvotePollController' => 'PhabricatorSlowvoteController', 'PhabricatorSlowvoteQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', @@ -5205,20 +5158,18 @@ phutil_register_library_map(array( 'PhabricatorTestStorageEngine' => 'PhabricatorFileStorageEngine', 'PhabricatorTestWorker' => 'PhabricatorWorker', 'PhabricatorTimeTestCase' => 'PhabricatorTestCase', - 'PhabricatorToken' => - array( - 0 => 'PhabricatorTokenDAO', - 1 => 'PhabricatorPolicyInterface', + 'PhabricatorToken' => array( + 'PhabricatorTokenDAO', + 'PhabricatorPolicyInterface', ), 'PhabricatorTokenController' => 'PhabricatorController', 'PhabricatorTokenCount' => 'PhabricatorTokenDAO', 'PhabricatorTokenCountQuery' => 'PhabricatorOffsetPagedQuery', 'PhabricatorTokenDAO' => 'PhabricatorLiskDAO', 'PhabricatorTokenGiveController' => 'PhabricatorTokenController', - 'PhabricatorTokenGiven' => - array( - 0 => 'PhabricatorTokenDAO', - 1 => 'PhabricatorPolicyInterface', + 'PhabricatorTokenGiven' => array( + 'PhabricatorTokenDAO', + 'PhabricatorPolicyInterface', ), 'PhabricatorTokenGivenController' => 'PhabricatorTokenController', 'PhabricatorTokenGivenEditor' => 'PhabricatorEditor', @@ -5234,12 +5185,13 @@ phutil_register_library_map(array( 'PhabricatorTranslationsConfigOptions' => 'PhabricatorApplicationConfigOptions', 'PhabricatorTrivialTestCase' => 'PhabricatorTestCase', 'PhabricatorTwoColumnExample' => 'PhabricatorUIExample', - 'PhabricatorTypeaheadCommonDatasourceController' => 'PhabricatorTypeaheadDatasourceController', 'PhabricatorTypeaheadCompositeDatasource' => 'PhabricatorTypeaheadDatasource', 'PhabricatorTypeaheadDatasource' => 'Phobject', 'PhabricatorTypeaheadDatasourceController' => 'PhabricatorController', 'PhabricatorTypeaheadModularDatasourceController' => 'PhabricatorTypeaheadDatasourceController', 'PhabricatorTypeaheadMonogramDatasource' => 'PhabricatorTypeaheadDatasource', + 'PhabricatorTypeaheadNoOwnerDatasource' => 'PhabricatorTypeaheadDatasource', + 'PhabricatorTypeaheadOwnerDatasource' => 'PhabricatorTypeaheadCompositeDatasource', 'PhabricatorTypeaheadRuntimeCompositeDatasource' => 'PhabricatorTypeaheadCompositeDatasource', 'PhabricatorUIConfigOptions' => 'PhabricatorApplicationConfigOptions', 'PhabricatorUIExampleRenderController' => 'PhabricatorController', @@ -5249,20 +5201,18 @@ phutil_register_library_map(array( 'PhabricatorUIStatusExample' => 'PhabricatorUIExample', 'PhabricatorUITooltipExample' => 'PhabricatorUIExample', 'PhabricatorUnitsTestCase' => 'PhabricatorTestCase', - 'PhabricatorUser' => - array( - 0 => 'PhabricatorUserDAO', - 1 => 'PhutilPerson', - 2 => 'PhabricatorPolicyInterface', - 3 => 'PhabricatorCustomFieldInterface', - 4 => 'PhabricatorDestructableInterface', + 'PhabricatorUser' => array( + 'PhabricatorUserDAO', + 'PhutilPerson', + 'PhabricatorPolicyInterface', + 'PhabricatorCustomFieldInterface', + 'PhabricatorDestructibleInterface', ), 'PhabricatorUserBlurbField' => 'PhabricatorUserCustomField', 'PhabricatorUserConfigOptions' => 'PhabricatorApplicationConfigOptions', - 'PhabricatorUserConfiguredCustomField' => - array( - 0 => 'PhabricatorUserCustomField', - 1 => 'PhabricatorStandardCustomFieldInterface', + 'PhabricatorUserConfiguredCustomField' => array( + 'PhabricatorUserCustomField', + 'PhabricatorStandardCustomFieldInterface', ), 'PhabricatorUserConfiguredCustomFieldStorage' => 'PhabricatorCustomFieldStorage', 'PhabricatorUserCustomField' => 'PhabricatorCustomField', @@ -5273,10 +5223,9 @@ phutil_register_library_map(array( 'PhabricatorUserEditorTestCase' => 'PhabricatorTestCase', 'PhabricatorUserEmail' => 'PhabricatorUserDAO', 'PhabricatorUserEmailTestCase' => 'PhabricatorTestCase', - 'PhabricatorUserLog' => - array( - 0 => 'PhabricatorUserDAO', - 1 => 'PhabricatorPolicyInterface', + 'PhabricatorUserLog' => array( + 'PhabricatorUserDAO', + 'PhabricatorPolicyInterface', ), 'PhabricatorUserLogView' => 'AphrontView', 'PhabricatorUserPreferences' => 'PhabricatorUserDAO', @@ -5326,11 +5275,10 @@ phutil_register_library_map(array( 'PhabricatorXHProfSampleListController' => 'PhabricatorXHProfController', 'PhameBasicBlogSkin' => 'PhameBlogSkin', 'PhameBasicTemplateBlogSkin' => 'PhameBasicBlogSkin', - 'PhameBlog' => - array( - 0 => 'PhameDAO', - 1 => 'PhabricatorPolicyInterface', - 2 => 'PhabricatorMarkupInterface', + 'PhameBlog' => array( + 'PhameDAO', + 'PhabricatorPolicyInterface', + 'PhabricatorMarkupInterface', ), 'PhameBlogDeleteController' => 'PhameController', 'PhameBlogEditController' => 'PhameController', @@ -5343,12 +5291,11 @@ phutil_register_library_map(array( 'PhameCelerityResources' => 'CelerityResources', 'PhameController' => 'PhabricatorController', 'PhameDAO' => 'PhabricatorLiskDAO', - 'PhamePost' => - array( - 0 => 'PhameDAO', - 1 => 'PhabricatorPolicyInterface', - 2 => 'PhabricatorMarkupInterface', - 3 => 'PhabricatorTokenReceiverInterface', + 'PhamePost' => array( + 'PhameDAO', + 'PhabricatorPolicyInterface', + 'PhabricatorMarkupInterface', + 'PhabricatorTokenReceiverInterface', ), 'PhamePostDeleteController' => 'PhameController', 'PhamePostEditController' => 'PhameController', @@ -5370,11 +5317,10 @@ phutil_register_library_map(array( 'PhluxPHIDTypeVariable' => 'PhabricatorPHIDType', 'PhluxTransaction' => 'PhabricatorApplicationTransaction', 'PhluxTransactionQuery' => 'PhabricatorApplicationTransactionQuery', - 'PhluxVariable' => - array( - 0 => 'PhluxDAO', - 1 => 'PhabricatorFlaggableInterface', - 2 => 'PhabricatorPolicyInterface', + 'PhluxVariable' => array( + 'PhluxDAO', + 'PhabricatorFlaggableInterface', + 'PhabricatorPolicyInterface', ), 'PhluxVariableEditor' => 'PhabricatorApplicationTransactionEditor', 'PhluxVariableQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', @@ -5384,28 +5330,26 @@ phutil_register_library_map(array( 'PholioCapabilityDefaultView' => 'PhabricatorPolicyCapability', 'PholioController' => 'PhabricatorController', 'PholioDAO' => 'PhabricatorLiskDAO', - 'PholioImage' => - array( - 0 => 'PholioDAO', - 1 => 'PhabricatorMarkupInterface', - 2 => 'PhabricatorPolicyInterface', + 'PholioImage' => array( + 'PholioDAO', + 'PhabricatorMarkupInterface', + 'PhabricatorPolicyInterface', ), 'PholioImageQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', 'PholioImageUploadController' => 'PholioController', 'PholioInlineController' => 'PholioController', 'PholioInlineListController' => 'PholioController', 'PholioInlineThumbController' => 'PholioController', - 'PholioMock' => - array( - 0 => 'PholioDAO', - 1 => 'PhabricatorMarkupInterface', - 2 => 'PhabricatorPolicyInterface', - 3 => 'PhabricatorSubscribableInterface', - 4 => 'PhabricatorTokenReceiverInterface', - 5 => 'PhabricatorFlaggableInterface', - 6 => 'PhabricatorApplicationTransactionInterface', - 7 => 'PhabricatorProjectInterface', - 8 => 'PhabricatorDestructableInterface', + 'PholioMock' => array( + 'PholioDAO', + 'PhabricatorMarkupInterface', + 'PhabricatorPolicyInterface', + 'PhabricatorSubscribableInterface', + 'PhabricatorTokenReceiverInterface', + 'PhabricatorFlaggableInterface', + 'PhabricatorApplicationTransactionInterface', + 'PhabricatorProjectInterface', + 'PhabricatorDestructibleInterface', ), 'PholioMockCommentController' => 'PholioController', 'PholioMockEditController' => 'PholioController', @@ -5429,10 +5373,9 @@ phutil_register_library_map(array( 'PholioTransactionType' => 'PholioConstants', 'PholioTransactionView' => 'PhabricatorApplicationTransactionView', 'PholioUploadedImageView' => 'AphrontView', - 'PhortuneAccount' => - array( - 0 => 'PhortuneDAO', - 1 => 'PhabricatorPolicyInterface', + 'PhortuneAccount' => array( + 'PhortuneDAO', + 'PhabricatorPolicyInterface', ), 'PhortuneAccountBuyController' => 'PhortuneController', 'PhortuneAccountEditor' => 'PhabricatorApplicationTransactionEditor', @@ -5452,10 +5395,9 @@ phutil_register_library_map(array( 'PhortuneMultiplePaymentProvidersException' => 'Exception', 'PhortuneNoPaymentProviderException' => 'Exception', 'PhortuneNotImplementedException' => 'Exception', - 'PhortunePaymentMethod' => - array( - 0 => 'PhortuneDAO', - 1 => 'PhabricatorPolicyInterface', + 'PhortunePaymentMethod' => array( + 'PhortuneDAO', + 'PhabricatorPolicyInterface', ), 'PhortunePaymentMethodEditController' => 'PhortuneController', 'PhortunePaymentMethodListController' => 'PhabricatorController', @@ -5463,10 +5405,9 @@ phutil_register_library_map(array( 'PhortunePaymentMethodViewController' => 'PhabricatorController', 'PhortunePaymentProviderTestCase' => 'PhabricatorTestCase', 'PhortunePaypalPaymentProvider' => 'PhortunePaymentProvider', - 'PhortuneProduct' => - array( - 0 => 'PhortuneDAO', - 1 => 'PhabricatorPolicyInterface', + 'PhortuneProduct' => array( + 'PhortuneDAO', + 'PhabricatorPolicyInterface', ), 'PhortuneProductEditController' => 'PhabricatorController', 'PhortuneProductEditor' => 'PhabricatorApplicationTransactionEditor', @@ -5486,16 +5427,14 @@ phutil_register_library_map(array( 'PhragmentController' => 'PhabricatorController', 'PhragmentCreateController' => 'PhragmentController', 'PhragmentDAO' => 'PhabricatorLiskDAO', - 'PhragmentFragment' => - array( - 0 => 'PhragmentDAO', - 1 => 'PhabricatorPolicyInterface', + 'PhragmentFragment' => array( + 'PhragmentDAO', + 'PhabricatorPolicyInterface', ), 'PhragmentFragmentQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', - 'PhragmentFragmentVersion' => - array( - 0 => 'PhragmentDAO', - 1 => 'PhabricatorPolicyInterface', + 'PhragmentFragmentVersion' => array( + 'PhragmentDAO', + 'PhabricatorPolicyInterface', ), 'PhragmentFragmentVersionQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', 'PhragmentHistoryController' => 'PhragmentController', @@ -5506,15 +5445,13 @@ phutil_register_library_map(array( 'PhragmentPatchUtil' => 'Phobject', 'PhragmentPolicyController' => 'PhragmentController', 'PhragmentRevertController' => 'PhragmentController', - 'PhragmentSnapshot' => - array( - 0 => 'PhragmentDAO', - 1 => 'PhabricatorPolicyInterface', + 'PhragmentSnapshot' => array( + 'PhragmentDAO', + 'PhabricatorPolicyInterface', ), - 'PhragmentSnapshotChild' => - array( - 0 => 'PhragmentDAO', - 1 => 'PhabricatorPolicyInterface', + 'PhragmentSnapshotChild' => array( + 'PhragmentDAO', + 'PhabricatorPolicyInterface', ), 'PhragmentSnapshotChildQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', 'PhragmentSnapshotCreateController' => 'PhragmentController', @@ -5531,34 +5468,33 @@ phutil_register_library_map(array( 'PhrequentSearchEngine' => 'PhabricatorApplicationSearchEngine', 'PhrequentTimeBlock' => 'Phobject', 'PhrequentTimeBlockTestCase' => 'PhabricatorTestCase', + 'PhrequentTimeSlices' => 'Phobject', 'PhrequentTrackController' => 'PhrequentController', 'PhrequentTrackingEditor' => 'PhabricatorEditor', 'PhrequentUIEventListener' => 'PhabricatorEventListener', - 'PhrequentUserTime' => - array( - 0 => 'PhrequentDAO', - 1 => 'PhabricatorPolicyInterface', + 'PhrequentUserTime' => array( + 'PhrequentDAO', + 'PhabricatorPolicyInterface', ), 'PhrequentUserTimeQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', 'PhrictionActionConstants' => 'PhrictionConstants', 'PhrictionActionMenuEventListener' => 'PhabricatorEventListener', 'PhrictionChangeType' => 'PhrictionConstants', - 'PhrictionContent' => - array( - 0 => 'PhrictionDAO', - 1 => 'PhabricatorMarkupInterface', + 'PhrictionContent' => array( + 'PhrictionDAO', + 'PhabricatorMarkupInterface', ), 'PhrictionController' => 'PhabricatorController', 'PhrictionDAO' => 'PhabricatorLiskDAO', 'PhrictionDeleteController' => 'PhrictionController', 'PhrictionDiffController' => 'PhrictionController', - 'PhrictionDocument' => - array( - 0 => 'PhrictionDAO', - 1 => 'PhabricatorPolicyInterface', - 2 => 'PhabricatorSubscribableInterface', - 3 => 'PhabricatorFlaggableInterface', - 4 => 'PhabricatorTokenReceiverInterface', + 'PhrictionDocument' => array( + 'PhrictionDAO', + 'PhabricatorPolicyInterface', + 'PhabricatorSubscribableInterface', + 'PhabricatorFlaggableInterface', + 'PhabricatorTokenReceiverInterface', + 'PhabricatorDestructibleInterface', ), 'PhrictionDocumentController' => 'PhrictionController', 'PhrictionDocumentEditor' => 'PhabricatorEditor', @@ -5576,15 +5512,14 @@ phutil_register_library_map(array( 'PhrictionSearchEngine' => 'PhabricatorApplicationSearchEngine', 'PhrictionSearchIndexer' => 'PhabricatorSearchDocumentIndexer', 'PonderAddAnswerView' => 'AphrontView', - 'PonderAnswer' => - array( - 0 => 'PonderDAO', - 1 => 'PhabricatorMarkupInterface', - 2 => 'PonderVotableInterface', - 3 => 'PhabricatorPolicyInterface', - 4 => 'PhabricatorFlaggableInterface', - 5 => 'PhabricatorSubscribableInterface', - 6 => 'PhabricatorTokenReceiverInterface', + 'PonderAnswer' => array( + 'PonderDAO', + 'PhabricatorMarkupInterface', + 'PonderVotableInterface', + 'PhabricatorPolicyInterface', + 'PhabricatorFlaggableInterface', + 'PhabricatorSubscribableInterface', + 'PhabricatorTokenReceiverInterface', ), 'PonderAnswerCommentController' => 'PonderController', 'PonderAnswerEditController' => 'PonderController', @@ -5595,10 +5530,9 @@ phutil_register_library_map(array( 'PonderAnswerTransaction' => 'PhabricatorApplicationTransaction', 'PonderAnswerTransactionComment' => 'PhabricatorApplicationTransactionComment', 'PonderAnswerTransactionQuery' => 'PhabricatorApplicationTransactionQuery', - 'PonderComment' => - array( - 0 => 'PonderDAO', - 1 => 'PhabricatorMarkupInterface', + 'PonderComment' => array( + 'PonderDAO', + 'PhabricatorMarkupInterface', ), 'PonderCommentQuery' => 'PhabricatorQuery', 'PonderController' => 'PhabricatorController', @@ -5606,16 +5540,15 @@ phutil_register_library_map(array( 'PonderEditor' => 'PhabricatorApplicationTransactionEditor', 'PonderPHIDTypeAnswer' => 'PhabricatorPHIDType', 'PonderPHIDTypeQuestion' => 'PhabricatorPHIDType', - 'PonderQuestion' => - array( - 0 => 'PonderDAO', - 1 => 'PhabricatorMarkupInterface', - 2 => 'PonderVotableInterface', - 3 => 'PhabricatorSubscribableInterface', - 4 => 'PhabricatorFlaggableInterface', - 5 => 'PhabricatorPolicyInterface', - 6 => 'PhabricatorTokenReceiverInterface', - 7 => 'PhabricatorProjectInterface', + 'PonderQuestion' => array( + 'PonderDAO', + 'PhabricatorMarkupInterface', + 'PonderVotableInterface', + 'PhabricatorSubscribableInterface', + 'PhabricatorFlaggableInterface', + 'PhabricatorPolicyInterface', + 'PhabricatorTokenReceiverInterface', + 'PhabricatorProjectInterface', ), 'PonderQuestionCommentController' => 'PonderController', 'PonderQuestionEditController' => 'PonderController', @@ -5643,10 +5576,9 @@ phutil_register_library_map(array( 'ProjectRemarkupRule' => 'PhabricatorRemarkupRuleObject', 'QueryFormattingTestCase' => 'PhabricatorTestCase', 'ReleephAuthorFieldSpecification' => 'ReleephFieldSpecification', - 'ReleephBranch' => - array( - 0 => 'ReleephDAO', - 1 => 'PhabricatorPolicyInterface', + 'ReleephBranch' => array( + 'ReleephDAO', + 'PhabricatorPolicyInterface', ), 'ReleephBranchAccessController' => 'ReleephBranchController', 'ReleephBranchCommitFieldSpecification' => 'ReleephFieldSpecification', @@ -5661,10 +5593,9 @@ phutil_register_library_map(array( 'ReleephBranchSearchEngine' => 'PhabricatorApplicationSearchEngine', 'ReleephBranchTransaction' => 'PhabricatorApplicationTransaction', 'ReleephBranchTransactionQuery' => 'PhabricatorApplicationTransactionQuery', - 'ReleephBranchViewController' => - array( - 0 => 'ReleephBranchController', - 1 => 'PhabricatorApplicationSearchResultsControllerInterface', + 'ReleephBranchViewController' => array( + 'ReleephBranchController', + 'PhabricatorApplicationSearchResultsControllerInterface', ), 'ReleephCommitFinderException' => 'Exception', 'ReleephCommitMessageFieldSpecification' => 'ReleephFieldSpecification', @@ -5676,10 +5607,9 @@ phutil_register_library_map(array( 'ReleephDiffMessageFieldSpecification' => 'ReleephFieldSpecification', 'ReleephDiffSizeFieldSpecification' => 'ReleephFieldSpecification', 'ReleephFieldParseException' => 'Exception', - 'ReleephFieldSpecification' => - array( - 0 => 'PhabricatorCustomField', - 1 => 'PhabricatorMarkupInterface', + 'ReleephFieldSpecification' => array( + 'PhabricatorCustomField', + 'PhabricatorMarkupInterface', ), 'ReleephIntentFieldSpecification' => 'ReleephFieldSpecification', 'ReleephLevelFieldSpecification' => 'ReleephFieldSpecification', @@ -5698,22 +5628,19 @@ phutil_register_library_map(array( 'ReleephProductSearchEngine' => 'PhabricatorApplicationSearchEngine', 'ReleephProductTransaction' => 'PhabricatorApplicationTransaction', 'ReleephProductTransactionQuery' => 'PhabricatorApplicationTransactionQuery', - 'ReleephProductViewController' => - array( - 0 => 'ReleephProductController', - 1 => 'PhabricatorApplicationSearchResultsControllerInterface', + 'ReleephProductViewController' => array( + 'ReleephProductController', + 'PhabricatorApplicationSearchResultsControllerInterface', ), - 'ReleephProject' => - array( - 0 => 'ReleephDAO', - 1 => 'PhabricatorPolicyInterface', + 'ReleephProject' => array( + 'ReleephDAO', + 'PhabricatorPolicyInterface', ), 'ReleephReasonFieldSpecification' => 'ReleephFieldSpecification', - 'ReleephRequest' => - array( - 0 => 'ReleephDAO', - 1 => 'PhabricatorPolicyInterface', - 2 => 'PhabricatorCustomFieldInterface', + 'ReleephRequest' => array( + 'ReleephDAO', + 'PhabricatorPolicyInterface', + 'PhabricatorCustomFieldInterface', ), 'ReleephRequestActionController' => 'ReleephRequestController', 'ReleephRequestCommentController' => 'ReleephRequestController', diff --git a/src/applications/audit/query/PhabricatorCommitSearchEngine.php b/src/applications/audit/query/PhabricatorCommitSearchEngine.php index 0a76163264..cc665358be 100644 --- a/src/applications/audit/query/PhabricatorCommitSearchEngine.php +++ b/src/applications/audit/query/PhabricatorCommitSearchEngine.php @@ -85,13 +85,13 @@ final class PhabricatorCommitSearchEngine $form ->appendChild( id(new AphrontFormTokenizerControl()) - ->setDatasource('/typeahead/common/usersprojectsorpackages/') + ->setDatasource(new DiffusionAuditorDatasource()) ->setName('auditorPHIDs') ->setLabel(pht('Auditors')) ->setValue(array_select_keys($handles, $auditor_phids))) ->appendChild( id(new AphrontFormTokenizerControl()) - ->setDatasource('/typeahead/common/users/') + ->setDatasource(new PhabricatorPeopleDatasource()) ->setName('authors') ->setLabel(pht('Commit Authors')) ->setValue(array_select_keys($handles, $commit_author_phids))) diff --git a/src/applications/auth/phid/PhabricatorAuthPHIDTypeAuthFactor.php b/src/applications/auth/phid/PhabricatorAuthPHIDTypeAuthFactor.php index 181882dcdd..58d239a7ea 100644 --- a/src/applications/auth/phid/PhabricatorAuthPHIDTypeAuthFactor.php +++ b/src/applications/auth/phid/PhabricatorAuthPHIDTypeAuthFactor.php @@ -4,10 +4,6 @@ final class PhabricatorAuthPHIDTypeAuthFactor extends PhabricatorPHIDType { const TYPECONST = 'AFTR'; - public function getTypeConstant() { - return self::TYPECONST; - } - public function getTypeName() { return pht('Auth Factor'); } diff --git a/src/applications/auth/provider/PhabricatorAuthProvider.php b/src/applications/auth/provider/PhabricatorAuthProvider.php index 0381f4822a..bc381ad636 100644 --- a/src/applications/auth/provider/PhabricatorAuthProvider.php +++ b/src/applications/auth/provider/PhabricatorAuthProvider.php @@ -180,7 +180,7 @@ abstract class PhabricatorAuthProvider { protected function renderLoginForm( AphrontRequest $request, $mode) { - throw new Exception('Not implemented!'); + throw new PhutilMethodNotImplementedException(); } public function createProviders() { @@ -295,7 +295,7 @@ abstract class PhabricatorAuthProvider { } public function getDefaultExternalAccount() { - throw new Exception('Not implemented!'); + throw new PhutilMethodNotImplementedException(); } public function getLoginOrder() { diff --git a/src/applications/calendar/phid/PhabricatorCalendarPHIDTypeEvent.php b/src/applications/calendar/phid/PhabricatorCalendarPHIDTypeEvent.php index 0fb7c9d086..a87eafba29 100644 --- a/src/applications/calendar/phid/PhabricatorCalendarPHIDTypeEvent.php +++ b/src/applications/calendar/phid/PhabricatorCalendarPHIDTypeEvent.php @@ -4,10 +4,6 @@ final class PhabricatorCalendarPHIDTypeEvent extends PhabricatorPHIDType { const TYPECONST = 'CEVT'; - public function getTypeConstant() { - return self::TYPECONST; - } - public function getTypeName() { return pht('Event'); } diff --git a/src/applications/calendar/query/PhabricatorCalendarEventSearchEngine.php b/src/applications/calendar/query/PhabricatorCalendarEventSearchEngine.php index c2f5674af5..ccb340653e 100644 --- a/src/applications/calendar/query/PhabricatorCalendarEventSearchEngine.php +++ b/src/applications/calendar/query/PhabricatorCalendarEventSearchEngine.php @@ -106,13 +106,13 @@ final class PhabricatorCalendarEventSearchEngine $form ->appendChild( id(new AphrontFormTokenizerControl()) - ->setDatasource('/typeahead/common/accounts/') + ->setDatasource(new PhabricatorPeopleDatasource()) ->setName('creators') ->setLabel(pht('Created By')) ->setValue($creator_handles)) ->appendChild( id(new AphrontFormTokenizerControl()) - ->setDatasource('/typeahead/common/accounts/') + ->setDatasource(new PhabricatorPeopleDatasource()) ->setName('invited') ->setLabel(pht('Invited')) ->setValue($invited_handles)) diff --git a/src/applications/config/phid/PhabricatorConfigPHIDTypeConfig.php b/src/applications/config/phid/PhabricatorConfigPHIDTypeConfig.php index 5742a7e9e5..793b63955a 100644 --- a/src/applications/config/phid/PhabricatorConfigPHIDTypeConfig.php +++ b/src/applications/config/phid/PhabricatorConfigPHIDTypeConfig.php @@ -4,10 +4,6 @@ final class PhabricatorConfigPHIDTypeConfig extends PhabricatorPHIDType { const TYPECONST = 'CONF'; - public function getTypeConstant() { - return self::TYPECONST; - } - public function getTypeName() { return pht('Config'); } diff --git a/src/applications/conpherence/controller/ConpherenceNewController.php b/src/applications/conpherence/controller/ConpherenceNewController.php index f224de2a13..dad9a95608 100644 --- a/src/applications/conpherence/controller/ConpherenceNewController.php +++ b/src/applications/conpherence/controller/ConpherenceNewController.php @@ -82,7 +82,7 @@ final class ConpherenceNewController extends ConpherenceController { ->setName('participants') ->setValue($participant_handles) ->setUser($user) - ->setDatasource('/typeahead/common/users/') + ->setDatasource(new PhabricatorPeopleDatasource()) ->setLabel(pht('To')) ->setError($e_participants)) ->appendChild( diff --git a/src/applications/conpherence/controller/ConpherenceUpdateController.php b/src/applications/conpherence/controller/ConpherenceUpdateController.php index 137d9f13ac..847dc26790 100644 --- a/src/applications/conpherence/controller/ConpherenceUpdateController.php +++ b/src/applications/conpherence/controller/ConpherenceUpdateController.php @@ -206,7 +206,7 @@ final class ConpherenceUpdateController id(new AphrontFormTokenizerControl()) ->setName('add_person') ->setUser($user) - ->setDatasource('/typeahead/common/users/')); + ->setDatasource(new PhabricatorPeopleDatasource())); require_celerity_resource('conpherence-update-css'); return id(new AphrontDialogView()) diff --git a/src/applications/conpherence/editor/ConpherenceEditor.php b/src/applications/conpherence/editor/ConpherenceEditor.php index 8389995b5c..5a16008818 100644 --- a/src/applications/conpherence/editor/ConpherenceEditor.php +++ b/src/applications/conpherence/editor/ConpherenceEditor.php @@ -216,8 +216,7 @@ final class ConpherenceEditor extends PhabricatorApplicationTransactionEditor { switch ($xaction->getTransactionType()) { case ConpherenceTransactionType::TYPE_FILES: - $editor = id(new PhabricatorEdgeEditor()) - ->setActor($this->getActor()); + $editor = new PhabricatorEdgeEditor(); $edge_type = PhabricatorEdgeConfig::TYPE_OBJECT_HAS_FILE; $old = array_fill_keys($xaction->getOldValue(), true); $new = array_fill_keys($xaction->getNewValue(), true); diff --git a/src/applications/conpherence/phid/PhabricatorConpherencePHIDTypeThread.php b/src/applications/conpherence/phid/PhabricatorConpherencePHIDTypeThread.php index 3a6319a954..d644774b5b 100644 --- a/src/applications/conpherence/phid/PhabricatorConpherencePHIDTypeThread.php +++ b/src/applications/conpherence/phid/PhabricatorConpherencePHIDTypeThread.php @@ -4,10 +4,6 @@ final class PhabricatorConpherencePHIDTypeThread extends PhabricatorPHIDType { const TYPECONST = 'CONP'; - public function getTypeConstant() { - return self::TYPECONST; - } - public function getTypeName() { return pht('Conpherence Thread'); } diff --git a/src/applications/countdown/phid/PhabricatorCountdownPHIDTypeCountdown.php b/src/applications/countdown/phid/PhabricatorCountdownPHIDTypeCountdown.php index ef60213d36..b859f80d5a 100644 --- a/src/applications/countdown/phid/PhabricatorCountdownPHIDTypeCountdown.php +++ b/src/applications/countdown/phid/PhabricatorCountdownPHIDTypeCountdown.php @@ -4,10 +4,6 @@ final class PhabricatorCountdownPHIDTypeCountdown extends PhabricatorPHIDType { const TYPECONST = 'CDWN'; - public function getTypeConstant() { - return self::TYPECONST; - } - public function getTypeName() { return pht('Countdown'); } diff --git a/src/applications/countdown/query/PhabricatorCountdownSearchEngine.php b/src/applications/countdown/query/PhabricatorCountdownSearchEngine.php index d0fc715683..b6e255134c 100644 --- a/src/applications/countdown/query/PhabricatorCountdownSearchEngine.php +++ b/src/applications/countdown/query/PhabricatorCountdownSearchEngine.php @@ -51,7 +51,7 @@ final class PhabricatorCountdownSearchEngine $form ->appendChild( id(new AphrontFormTokenizerControl()) - ->setDatasource('/typeahead/common/users/') + ->setDatasource(new PhabricatorPeopleDatasource()) ->setName('authors') ->setLabel(pht('Authors')) ->setValue($author_handles)) diff --git a/src/applications/dashboard/phid/PhabricatorDashboardPHIDTypeDashboard.php b/src/applications/dashboard/phid/PhabricatorDashboardPHIDTypeDashboard.php index 0af0fd3d9d..67a27a892c 100644 --- a/src/applications/dashboard/phid/PhabricatorDashboardPHIDTypeDashboard.php +++ b/src/applications/dashboard/phid/PhabricatorDashboardPHIDTypeDashboard.php @@ -4,10 +4,6 @@ final class PhabricatorDashboardPHIDTypeDashboard extends PhabricatorPHIDType { const TYPECONST = 'DSHB'; - public function getTypeConstant() { - return self::TYPECONST; - } - public function getTypeName() { return pht('Dashboard'); } diff --git a/src/applications/dashboard/phid/PhabricatorDashboardPHIDTypePanel.php b/src/applications/dashboard/phid/PhabricatorDashboardPHIDTypePanel.php index 882f728c1e..ec552a242b 100644 --- a/src/applications/dashboard/phid/PhabricatorDashboardPHIDTypePanel.php +++ b/src/applications/dashboard/phid/PhabricatorDashboardPHIDTypePanel.php @@ -4,10 +4,6 @@ final class PhabricatorDashboardPHIDTypePanel extends PhabricatorPHIDType { const TYPECONST = 'DSHP'; - public function getTypeConstant() { - return self::TYPECONST; - } - public function getTypeName() { return pht('Panel'); } diff --git a/src/applications/differential/customfield/DifferentialJIRAIssuesField.php b/src/applications/differential/customfield/DifferentialJIRAIssuesField.php index 12c7ea9ebb..3d0c6d61ac 100644 --- a/src/applications/differential/customfield/DifferentialJIRAIssuesField.php +++ b/src/applications/differential/customfield/DifferentialJIRAIssuesField.php @@ -257,8 +257,7 @@ final class DifferentialJIRAIssuesField $revision_phid, $edge_type); - $editor = id(new PhabricatorEdgeEditor()) - ->setActor($this->getViewer()); + $editor = new PhabricatorEdgeEditor(); foreach (array_diff($edges, $edge_dsts) as $rem_edge) { $editor->removeEdge($revision_phid, $edge_type, $rem_edge); diff --git a/src/applications/differential/customfield/DifferentialManiphestTasksField.php b/src/applications/differential/customfield/DifferentialManiphestTasksField.php index 6e12b46a01..fbf05c708f 100644 --- a/src/applications/differential/customfield/DifferentialManiphestTasksField.php +++ b/src/applications/differential/customfield/DifferentialManiphestTasksField.php @@ -42,7 +42,7 @@ final class DifferentialManiphestTasksField return PhabricatorEdgeQuery::loadDestinationPHIDs( $revision->getPHID(), - PhabricatorEdgeConfig::TYPE_DREV_HAS_RELATED_TASK); + DifferentialRevisionHasTaskEdgeType::EDGECONST); } public function getApplicationTransactionType() { @@ -51,7 +51,7 @@ final class DifferentialManiphestTasksField public function getApplicationTransactionMetadata() { return array( - 'edge:type' => PhabricatorEdgeConfig::TYPE_DREV_HAS_RELATED_TASK, + 'edge:type' => DifferentialRevisionHasTaskEdgeType::EDGECONST, ); } diff --git a/src/applications/differential/customfield/DifferentialProjectsField.php b/src/applications/differential/customfield/DifferentialProjectsField.php index 461c60b1b2..72762bee69 100644 --- a/src/applications/differential/customfield/DifferentialProjectsField.php +++ b/src/applications/differential/customfield/DifferentialProjectsField.php @@ -35,7 +35,7 @@ final class DifferentialProjectsField $projects = PhabricatorEdgeQuery::loadDestinationPHIDs( $revision->getPHID(), - PhabricatorEdgeConfig::TYPE_OBJECT_HAS_PROJECT); + PhabricatorProjectObjectHasProjectEdgeType::EDGECONST); $projects = array_reverse($projects); return $projects; @@ -97,7 +97,9 @@ final class DifferentialProjectsField } public function getApplicationTransactionMetadata() { - return array('edge:type' => PhabricatorEdgeConfig::TYPE_OBJECT_HAS_PROJECT); + return array( + 'edge:type' => PhabricatorProjectObjectHasProjectEdgeType::EDGECONST, + ); } public function parseValueFromCommitMessage($value) { diff --git a/src/applications/differential/customfield/DifferentialReviewersField.php b/src/applications/differential/customfield/DifferentialReviewersField.php index 5ff0a2f9f2..d3f24b7d3a 100644 --- a/src/applications/differential/customfield/DifferentialReviewersField.php +++ b/src/applications/differential/customfield/DifferentialReviewersField.php @@ -69,7 +69,7 @@ final class DifferentialReviewersField public function renderEditControl(array $handles) { return id(new AphrontFormTokenizerControl()) ->setName($this->getFieldKey()) - ->setDatasource('/typeahead/common/usersorprojects/') + ->setDatasource(new PhabricatorProjectOrUserDatasource()) ->setValue($handles) ->setError($this->getFieldError()) ->setLabel($this->getFieldName()); diff --git a/src/applications/differential/customfield/DifferentialSubscribersField.php b/src/applications/differential/customfield/DifferentialSubscribersField.php index 4d2a9f016a..eba9a62025 100644 --- a/src/applications/differential/customfield/DifferentialSubscribersField.php +++ b/src/applications/differential/customfield/DifferentialSubscribersField.php @@ -44,7 +44,7 @@ final class DifferentialSubscribersField public function renderEditControl(array $handles) { return id(new AphrontFormTokenizerControl()) ->setName($this->getFieldKey()) - ->setDatasource('/typeahead/common/mailable/') + ->setDatasource(new PhabricatorMetaMTAMailableDatasource()) ->setValue($handles) ->setError($this->getFieldError()) ->setLabel($this->getFieldName()); diff --git a/src/applications/differential/edge/DifferentialRevisionHasTaskEdgeType.php b/src/applications/differential/edge/DifferentialRevisionHasTaskEdgeType.php new file mode 100644 index 0000000000..de9a9cad57 --- /dev/null +++ b/src/applications/differential/edge/DifferentialRevisionHasTaskEdgeType.php @@ -0,0 +1,105 @@ +execute(); if ($tasks) { - $edge_related = PhabricatorEdgeConfig::TYPE_DREV_HAS_RELATED_TASK; + $edge_related = DifferentialRevisionHasTaskEdgeType::EDGECONST; $edges[$edge_related] = mpull($tasks, 'getPHID', 'getPHID'); } } diff --git a/src/applications/differential/event/DifferentialHovercardEventListener.php b/src/applications/differential/event/DifferentialHovercardEventListener.php index ae9fd0011b..06b5cfde96 100644 --- a/src/applications/differential/event/DifferentialHovercardEventListener.php +++ b/src/applications/differential/event/DifferentialHovercardEventListener.php @@ -28,7 +28,7 @@ final class DifferentialHovercardEventListener $rev->loadRelationships(); $reviewer_phids = $rev->getReviewers(); - $e_task = PhabricatorEdgeConfig::TYPE_DREV_HAS_RELATED_TASK; + $e_task = DifferentialRevisionHasTaskEdgeType::EDGECONST; $edge_query = id(new PhabricatorEdgeQuery()) ->withSourcePHIDs(array($phid)) ->withEdgeTypes( diff --git a/src/applications/differential/phid/DifferentialPHIDTypeDiff.php b/src/applications/differential/phid/DifferentialPHIDTypeDiff.php index dda8b61b94..c5f6e44dc9 100644 --- a/src/applications/differential/phid/DifferentialPHIDTypeDiff.php +++ b/src/applications/differential/phid/DifferentialPHIDTypeDiff.php @@ -4,10 +4,6 @@ final class DifferentialPHIDTypeDiff extends PhabricatorPHIDType { const TYPECONST = 'DIFF'; - public function getTypeConstant() { - return self::TYPECONST; - } - public function getTypeName() { return pht('Differential Diff'); } diff --git a/src/applications/differential/phid/DifferentialPHIDTypeRevision.php b/src/applications/differential/phid/DifferentialPHIDTypeRevision.php index 50a5f42cc4..1cf0154bf5 100644 --- a/src/applications/differential/phid/DifferentialPHIDTypeRevision.php +++ b/src/applications/differential/phid/DifferentialPHIDTypeRevision.php @@ -4,10 +4,6 @@ final class DifferentialPHIDTypeRevision extends PhabricatorPHIDType { const TYPECONST = 'DREV'; - public function getTypeConstant() { - return self::TYPECONST; - } - public function getTypeName() { return pht('Revision'); } diff --git a/src/applications/differential/query/DifferentialRevisionSearchEngine.php b/src/applications/differential/query/DifferentialRevisionSearchEngine.php index 41d9f97948..c3d921d752 100644 --- a/src/applications/differential/query/DifferentialRevisionSearchEngine.php +++ b/src/applications/differential/query/DifferentialRevisionSearchEngine.php @@ -143,25 +143,25 @@ final class DifferentialRevisionSearchEngine id(new AphrontFormTokenizerControl()) ->setLabel(pht('Responsible Users')) ->setName('responsibles') - ->setDatasource('/typeahead/common/accounts/') + ->setDatasource(new PhabricatorPeopleDatasource()) ->setValue(array_select_keys($handles, $responsible_phids))) ->appendChild( id(new AphrontFormTokenizerControl()) ->setLabel(pht('Authors')) ->setName('authors') - ->setDatasource('/typeahead/common/accounts/') + ->setDatasource(new PhabricatorPeopleDatasource()) ->setValue(array_select_keys($handles, $author_phids))) ->appendChild( id(new AphrontFormTokenizerControl()) ->setLabel(pht('Reviewers')) ->setName('reviewers') - ->setDatasource('/typeahead/common/accountsorprojects/') + ->setDatasource(new PhabricatorProjectOrUserDatasource()) ->setValue(array_select_keys($handles, $reviewer_phids))) ->appendChild( id(new AphrontFormTokenizerControl()) ->setLabel(pht('Subscribers')) ->setName('subscribers') - ->setDatasource('/typeahead/common/allmailable/') + ->setDatasource(new PhabricatorMetaMTAMailableDatasource()) ->setValue(array_select_keys($handles, $subscriber_phids))) ->appendChild( id(new AphrontFormTokenizerControl()) diff --git a/src/applications/differential/render/DifferentialChangesetOneUpRenderer.php b/src/applications/differential/render/DifferentialChangesetOneUpRenderer.php index ac3c2a7d1a..b214f74c5f 100644 --- a/src/applications/differential/render/DifferentialChangesetOneUpRenderer.php +++ b/src/applications/differential/render/DifferentialChangesetOneUpRenderer.php @@ -67,11 +67,13 @@ final class DifferentialChangesetOneUpRenderer return null; } - public function renderFileChange($old_file = null, - $new_file = null, - $id = 0, - $vs = 0) { - throw new Exception('Not implemented!'); + public function renderFileChange( + $old_file = null, + $new_file = null, + $id = 0, + $vs = 0) { + + throw new PhutilMethodNotImplementedException(); } } diff --git a/src/applications/differential/render/DifferentialChangesetTestRenderer.php b/src/applications/differential/render/DifferentialChangesetTestRenderer.php index 4dd0ff7646..9941c8a6db 100644 --- a/src/applications/differential/render/DifferentialChangesetTestRenderer.php +++ b/src/applications/differential/render/DifferentialChangesetTestRenderer.php @@ -76,11 +76,13 @@ abstract class DifferentialChangesetTestRenderer } - public function renderFileChange($old_file = null, - $new_file = null, - $id = 0, - $vs = 0) { - throw new Exception('Not implemented!'); + public function renderFileChange( + $old_file = null, + $new_file = null, + $id = 0, + $vs = 0) { + + throw new PhutilMethodNotImplementedException(); } } diff --git a/src/applications/differential/storage/DifferentialDiff.php b/src/applications/differential/storage/DifferentialDiff.php index e0a0e7da59..5f92f05313 100644 --- a/src/applications/differential/storage/DifferentialDiff.php +++ b/src/applications/differential/storage/DifferentialDiff.php @@ -6,7 +6,7 @@ final class DifferentialDiff PhabricatorPolicyInterface, HarbormasterBuildableInterface, PhabricatorApplicationTransactionInterface, - PhabricatorDestructableInterface { + PhabricatorDestructibleInterface { protected $revisionID; protected $authorPHID; @@ -392,7 +392,7 @@ final class DifferentialDiff } -/* -( PhabricatorDestructableInterface )----------------------------------- */ +/* -( PhabricatorDestructibleInterface )----------------------------------- */ public function destroyObjectPermanently( diff --git a/src/applications/differential/storage/DifferentialRevision.php b/src/applications/differential/storage/DifferentialRevision.php index 2446e67173..a7146a8ccb 100644 --- a/src/applications/differential/storage/DifferentialRevision.php +++ b/src/applications/differential/storage/DifferentialRevision.php @@ -10,7 +10,7 @@ final class DifferentialRevision extends DifferentialDAO PhabricatorSubscribableInterface, PhabricatorCustomFieldInterface, PhabricatorApplicationTransactionInterface, - PhabricatorDestructableInterface, + PhabricatorDestructibleInterface, PhabricatorProjectInterface { protected $title = ''; @@ -449,7 +449,7 @@ final class DifferentialRevision extends DifferentialDAO } -/* -( PhabricatorDestructableInterface )----------------------------------- */ +/* -( PhabricatorDestructibleInterface )----------------------------------- */ public function destroyObjectPermanently( diff --git a/src/applications/differential/view/DifferentialAddCommentView.php b/src/applications/differential/view/DifferentialAddCommentView.php index 9ccd73971c..acb657bd2e 100644 --- a/src/applications/differential/view/DifferentialAddCommentView.php +++ b/src/applications/differential/view/DifferentialAddCommentView.php @@ -108,6 +108,9 @@ final class DifferentialAddCommentView extends AphrontView { id(new AphrontFormSubmitControl()) ->setValue(pht('Submit'))); + $mailable_source = new PhabricatorMetaMTAMailableDatasource(); + $reviewer_source = new PhabricatorProjectOrUserDatasource(); + Javelin::initBehavior( 'differential-add-reviewers-and-ccs', array( @@ -118,18 +121,18 @@ final class DifferentialAddCommentView extends AphrontView { 'add_reviewers' => 1, 'resign' => 1, ), - 'src' => '/typeahead/common/usersorprojects/', + 'src' => $reviewer_source->getDatasourceURI(), 'value' => $this->reviewers, 'row' => 'add-reviewers', 'labels' => $add_reviewers_labels, - 'placeholder' => pht('Type a user or project name...'), + 'placeholder' => $reviewer_source->getPlaceholderText(), ), 'add-ccs-tokenizer' => array( 'actions' => array('add_ccs' => 1), - 'src' => '/typeahead/common/mailable/', + 'src' => $mailable_source->getDatasourceURI(), 'value' => $this->ccs, 'row' => 'add-ccs', - 'placeholder' => pht('Type a user or mailing list...'), + 'placeholder' => $mailable_source->getPlaceholderText(), ), ), 'select' => 'comment-action', diff --git a/src/applications/diffusion/conduit/ConduitAPI_diffusion_getcommits_Method.php b/src/applications/diffusion/conduit/ConduitAPI_diffusion_getcommits_Method.php index 46139ba66b..05a6a33dcf 100644 --- a/src/applications/diffusion/conduit/ConduitAPI_diffusion_getcommits_Method.php +++ b/src/applications/diffusion/conduit/ConduitAPI_diffusion_getcommits_Method.php @@ -269,7 +269,7 @@ final class ConduitAPI_diffusion_getcommits_Method * Enhances the commits list with Maniphest information. */ private function addManiphestInformation(array $commits) { - $task_type = PhabricatorEdgeConfig::TYPE_COMMIT_HAS_TASK; + $task_type = DiffusionCommitHasTaskEdgeType::EDGECONST; $commit_phids = ipull($commits, 'commitPHID'); diff --git a/src/applications/diffusion/controller/DiffusionCommitController.php b/src/applications/diffusion/controller/DiffusionCommitController.php index c7dfdfd652..86f3996135 100644 --- a/src/applications/diffusion/controller/DiffusionCommitController.php +++ b/src/applications/diffusion/controller/DiffusionCommitController.php @@ -420,7 +420,7 @@ final class DiffusionCommitController extends DiffusionController { $edge_query = id(new PhabricatorEdgeQuery()) ->withSourcePHIDs(array($commit_phid)) ->withEdgeTypes(array( - PhabricatorEdgeConfig::TYPE_COMMIT_HAS_TASK, + DiffusionCommitHasTaskEdgeType::EDGECONST, PhabricatorEdgeConfig::TYPE_COMMIT_HAS_PROJECT, PhabricatorEdgeConfig::TYPE_COMMIT_HAS_DREV, )); @@ -428,7 +428,7 @@ final class DiffusionCommitController extends DiffusionController { $edges = $edge_query->execute(); $task_phids = array_keys( - $edges[$commit_phid][PhabricatorEdgeConfig::TYPE_COMMIT_HAS_TASK]); + $edges[$commit_phid][DiffusionCommitHasTaskEdgeType::EDGECONST]); $proj_phids = array_keys( $edges[$commit_phid][PhabricatorEdgeConfig::TYPE_COMMIT_HAS_PROJECT]); $revision_phid = key( @@ -771,21 +771,24 @@ final class DiffusionCommitController extends DiffusionController { require_celerity_resource('phabricator-transaction-view-css'); + $mailable_source = new PhabricatorMetaMTAMailableDatasource(); + $auditor_source = new DiffusionAuditorDatasource(); + Javelin::initBehavior( 'differential-add-reviewers-and-ccs', array( 'dynamic' => array( 'add-auditors-tokenizer' => array( 'actions' => array('add_auditors' => 1), - 'src' => '/typeahead/common/usersprojectsorpackages/', + 'src' => $auditor_source->getDatasourceURI(), 'row' => 'add-auditors', - 'placeholder' => pht('Type a user, project, or package name...'), + 'placeholder' => $auditor_source->getPlaceholderText(), ), 'add-ccs-tokenizer' => array( 'actions' => array('add_ccs' => 1), - 'src' => '/typeahead/common/mailable/', + 'src' => $mailable_source->getDatasourceURI(), 'row' => 'add-ccs', - 'placeholder' => pht('Type a user or mailing list...'), + 'placeholder' => $mailable_source->getPlaceholderText(), ), ), 'select' => 'audit-action', diff --git a/src/applications/diffusion/controller/DiffusionCommitEditController.php b/src/applications/diffusion/controller/DiffusionCommitEditController.php index 35445cabe3..8ce41bb600 100644 --- a/src/applications/diffusion/controller/DiffusionCommitEditController.php +++ b/src/applications/diffusion/controller/DiffusionCommitEditController.php @@ -34,8 +34,8 @@ final class DiffusionCommitEditController extends DiffusionController { $new_proj_phids = array_values($proj_phids); $rem_proj_phids = array_diff($current_proj_phids, $new_proj_phids); - $editor = id(new PhabricatorEdgeEditor()); - $editor->setActor($user); + + $editor = id(new PhabricatorEdgeEditor()); foreach ($rem_proj_phids as $phid) { $editor->removeEdge($commit_phid, $edge_type, $phid); } diff --git a/src/applications/diffusion/controller/DiffusionLintController.php b/src/applications/diffusion/controller/DiffusionLintController.php index b6ce4a423d..fa8693aa62 100644 --- a/src/applications/diffusion/controller/DiffusionLintController.php +++ b/src/applications/diffusion/controller/DiffusionLintController.php @@ -112,7 +112,7 @@ final class DiffusionLintController extends DiffusionController { ->setMethod('GET') ->appendChild( id(new AphrontFormTokenizerControl()) - ->setDatasource('/typeahead/common/users/') + ->setDatasource(new PhabricatorPeopleDatasource()) ->setLimit(1) ->setName('owner') ->setLabel(pht('Owner')) diff --git a/src/applications/diffusion/controller/DiffusionRepositoryController.php b/src/applications/diffusion/controller/DiffusionRepositoryController.php index 151c5f8a2c..9d26926345 100644 --- a/src/applications/diffusion/controller/DiffusionRepositoryController.php +++ b/src/applications/diffusion/controller/DiffusionRepositoryController.php @@ -231,7 +231,7 @@ final class DiffusionRepositoryController extends DiffusionController { $project_phids = PhabricatorEdgeQuery::loadDestinationPHIDs( $repository->getPHID(), - PhabricatorEdgeConfig::TYPE_OBJECT_HAS_PROJECT); + PhabricatorProjectObjectHasProjectEdgeType::EDGECONST); if ($project_phids) { $this->loadHandles($project_phids); $view->addProperty( diff --git a/src/applications/diffusion/controller/DiffusionRepositoryEditBasicController.php b/src/applications/diffusion/controller/DiffusionRepositoryEditBasicController.php index 7fa932f551..1f6bb5acc1 100644 --- a/src/applications/diffusion/controller/DiffusionRepositoryEditBasicController.php +++ b/src/applications/diffusion/controller/DiffusionRepositoryEditBasicController.php @@ -73,7 +73,7 @@ final class DiffusionRepositoryEditBasicController ->setTransactionType($type_edge) ->setMetadataValue( 'edge:type', - PhabricatorEdgeConfig::TYPE_OBJECT_HAS_PROJECT) + PhabricatorProjectObjectHasProjectEdgeType::EDGECONST) ->setNewValue( array( '=' => array_fuse($v_projects), diff --git a/src/applications/diffusion/controller/DiffusionRepositoryEditMainController.php b/src/applications/diffusion/controller/DiffusionRepositoryEditMainController.php index 16dd3a8309..acf1fef1d3 100644 --- a/src/applications/diffusion/controller/DiffusionRepositoryEditMainController.php +++ b/src/applications/diffusion/controller/DiffusionRepositoryEditMainController.php @@ -265,7 +265,7 @@ final class DiffusionRepositoryEditMainController $project_phids = PhabricatorEdgeQuery::loadDestinationPHIDs( $repository->getPHID(), - PhabricatorEdgeConfig::TYPE_OBJECT_HAS_PROJECT); + PhabricatorProjectObjectHasProjectEdgeType::EDGECONST); if ($project_phids) { $this->loadHandles($project_phids); $project_text = $this->renderHandlesForPHIDs($project_phids); diff --git a/src/applications/diffusion/edge/DiffusionCommitHasTaskEdgeType.php b/src/applications/diffusion/edge/DiffusionCommitHasTaskEdgeType.php new file mode 100644 index 0000000000..516fcdf023 --- /dev/null +++ b/src/applications/diffusion/edge/DiffusionCommitHasTaskEdgeType.php @@ -0,0 +1,103 @@ +setName($repo->getMonogram().' '.$repo->getName()) ->setURI('/diffusion/'.$repo->getCallsign().'/') ->setPHID($repo->getPHID()) - ->setPriorityString($repo->getMonogram()) - ->setIcon('fa-database bluegrey'); + ->setPriorityString($repo->getMonogram()); } return $results; diff --git a/src/applications/diffusion/typeahead/DiffusionSymbolDatasource.php b/src/applications/diffusion/typeahead/DiffusionSymbolDatasource.php new file mode 100644 index 0000000000..bfc34806f9 --- /dev/null +++ b/src/applications/diffusion/typeahead/DiffusionSymbolDatasource.php @@ -0,0 +1,47 @@ +getViewer(); + $raw_query = $this->getRawQuery(); + + $results = array(); + + if (strlen($raw_query)) { + $symbols = id(new DiffusionSymbolQuery()) + ->setNamePrefix($raw_query) + ->setLimit(15) + ->needArcanistProjects(true) + ->needRepositories(true) + ->needPaths(true) + ->execute(); + foreach ($symbols as $symbol) { + $lang = $symbol->getSymbolLanguage(); + $name = $symbol->getSymbolName(); + $type = $symbol->getSymbolType(); + $proj = $symbol->getArcanistProject()->getName(); + + $results[] = id(new PhabricatorTypeaheadResult()) + ->setName($name) + ->setURI($symbol->getURI()) + ->setPHID(md5($symbol->getURI())) // Just needs to be unique. + ->setDisplayName($name) + ->setDisplayType(strtoupper($lang).' '.ucwords($type).' ('.$proj.')') + ->setPriorityType('symb'); + } + } + + return $results; + } + +} diff --git a/src/applications/diviner/phid/DivinerPHIDTypeAtom.php b/src/applications/diviner/phid/DivinerPHIDTypeAtom.php index 6a057c0741..a47efb322b 100644 --- a/src/applications/diviner/phid/DivinerPHIDTypeAtom.php +++ b/src/applications/diviner/phid/DivinerPHIDTypeAtom.php @@ -4,10 +4,6 @@ final class DivinerPHIDTypeAtom extends PhabricatorPHIDType { const TYPECONST = 'ATOM'; - public function getTypeConstant() { - return self::TYPECONST; - } - public function getTypeName() { return pht('Atom'); } diff --git a/src/applications/diviner/phid/DivinerPHIDTypeBook.php b/src/applications/diviner/phid/DivinerPHIDTypeBook.php index 3bd965ee78..af2ebb11e0 100644 --- a/src/applications/diviner/phid/DivinerPHIDTypeBook.php +++ b/src/applications/diviner/phid/DivinerPHIDTypeBook.php @@ -4,10 +4,6 @@ final class DivinerPHIDTypeBook extends PhabricatorPHIDType { const TYPECONST = 'BOOK'; - public function getTypeConstant() { - return self::TYPECONST; - } - public function getTypeName() { return pht('Book'); } diff --git a/src/applications/doorkeeper/worker/DoorkeeperFeedWorkerAsana.php b/src/applications/doorkeeper/worker/DoorkeeperFeedWorkerAsana.php index 4cb18ea80d..804fe18a48 100644 --- a/src/applications/doorkeeper/worker/DoorkeeperFeedWorkerAsana.php +++ b/src/applications/doorkeeper/worker/DoorkeeperFeedWorkerAsana.php @@ -235,7 +235,6 @@ final class DoorkeeperFeedWorkerAsana extends DoorkeeperFeedWorker { ); id(new PhabricatorEdgeEditor()) - ->setActor($viewer) ->addEdge($src_phid, $etype_main, $dst_phid, $edge_options) ->save(); @@ -247,8 +246,7 @@ final class DoorkeeperFeedWorkerAsana extends DoorkeeperFeedWorker { // Now, handle the subtasks. - $sub_editor = id(new PhabricatorEdgeEditor()) - ->setActor($viewer); + $sub_editor = new PhabricatorEdgeEditor(); // First, find all the object references in Phabricator for tasks that we // know about and import their objects from Asana. diff --git a/src/applications/drydock/phid/DrydockPHIDTypeBlueprint.php b/src/applications/drydock/phid/DrydockPHIDTypeBlueprint.php index 22b074285e..553205cf77 100644 --- a/src/applications/drydock/phid/DrydockPHIDTypeBlueprint.php +++ b/src/applications/drydock/phid/DrydockPHIDTypeBlueprint.php @@ -4,10 +4,6 @@ final class DrydockPHIDTypeBlueprint extends PhabricatorPHIDType { const TYPECONST = 'DRYB'; - public function getTypeConstant() { - return self::TYPECONST; - } - public function getTypeName() { return pht('Blueprint'); } diff --git a/src/applications/drydock/phid/DrydockPHIDTypeLease.php b/src/applications/drydock/phid/DrydockPHIDTypeLease.php index f3f34be0c7..55649c9d92 100644 --- a/src/applications/drydock/phid/DrydockPHIDTypeLease.php +++ b/src/applications/drydock/phid/DrydockPHIDTypeLease.php @@ -4,10 +4,6 @@ final class DrydockPHIDTypeLease extends PhabricatorPHIDType { const TYPECONST = 'DRYL'; - public function getTypeConstant() { - return self::TYPECONST; - } - public function getTypeName() { return pht('Drydock Lease'); } diff --git a/src/applications/drydock/phid/DrydockPHIDTypeResource.php b/src/applications/drydock/phid/DrydockPHIDTypeResource.php index f6bc00f689..ffe76c6e7a 100644 --- a/src/applications/drydock/phid/DrydockPHIDTypeResource.php +++ b/src/applications/drydock/phid/DrydockPHIDTypeResource.php @@ -4,10 +4,6 @@ final class DrydockPHIDTypeResource extends PhabricatorPHIDType { const TYPECONST = 'DRYR'; - public function getTypeConstant() { - return self::TYPECONST; - } - public function getTypeName() { return pht('Drydock Resource'); } diff --git a/src/applications/feed/PhabricatorFeedStoryPublisher.php b/src/applications/feed/PhabricatorFeedStoryPublisher.php index fbbeee48a0..9770c89db9 100644 --- a/src/applications/feed/PhabricatorFeedStoryPublisher.php +++ b/src/applications/feed/PhabricatorFeedStoryPublisher.php @@ -176,7 +176,7 @@ final class PhabricatorFeedStoryPublisher { $data = array( 'key' => (string)$chrono_key, 'type' => 'notification', - 'subscribers' => $this->subscribedPHIDs, + 'subscribers' => array_values($this->subscribedPHIDs), ); PhabricatorNotificationClient::tryToPostMessage($data); diff --git a/src/applications/feed/query/PhabricatorFeedSearchEngine.php b/src/applications/feed/query/PhabricatorFeedSearchEngine.php index f9c996c5a6..268406a335 100644 --- a/src/applications/feed/query/PhabricatorFeedSearchEngine.php +++ b/src/applications/feed/query/PhabricatorFeedSearchEngine.php @@ -78,7 +78,7 @@ final class PhabricatorFeedSearchEngine $form ->appendChild( id(new AphrontFormTokenizerControl()) - ->setDatasource('/typeahead/common/users/') + ->setDatasource(new PhabricatorPeopleDatasource()) ->setName('users') ->setLabel(pht('Include Users')) ->setValue($user_handles)) diff --git a/src/applications/files/phid/PhabricatorFilePHIDTypeFile.php b/src/applications/files/phid/PhabricatorFilePHIDTypeFile.php index 1f6fe80df6..d655511a31 100644 --- a/src/applications/files/phid/PhabricatorFilePHIDTypeFile.php +++ b/src/applications/files/phid/PhabricatorFilePHIDTypeFile.php @@ -4,10 +4,6 @@ final class PhabricatorFilePHIDTypeFile extends PhabricatorPHIDType { const TYPECONST = 'FILE'; - public function getTypeConstant() { - return self::TYPECONST; - } - public function getTypeName() { return pht('File'); } diff --git a/src/applications/files/query/PhabricatorFileSearchEngine.php b/src/applications/files/query/PhabricatorFileSearchEngine.php index afde191e62..d91110f8b9 100644 --- a/src/applications/files/query/PhabricatorFileSearchEngine.php +++ b/src/applications/files/query/PhabricatorFileSearchEngine.php @@ -61,7 +61,7 @@ final class PhabricatorFileSearchEngine $form ->appendChild( id(new AphrontFormTokenizerControl()) - ->setDatasource('/typeahead/common/users/') + ->setDatasource(new PhabricatorPeopleDatasource()) ->setName('authors') ->setLabel(pht('Authors')) ->setValue($author_handles)) diff --git a/src/applications/files/storage/PhabricatorFile.php b/src/applications/files/storage/PhabricatorFile.php index 8d7a0ba245..f9ef410dcd 100644 --- a/src/applications/files/storage/PhabricatorFile.php +++ b/src/applications/files/storage/PhabricatorFile.php @@ -859,8 +859,6 @@ final class PhabricatorFile extends PhabricatorFileDAO $edge_type = PhabricatorEdgeConfig::TYPE_OBJECT_HAS_FILE; id(new PhabricatorEdgeEditor()) - ->setActor($actor) - ->setSuppressEvents(true) ->addEdge($phid, $edge_type, $this->getPHID()) ->save(); diff --git a/src/applications/harbormaster/phid/HarbormasterPHIDTypeBuild.php b/src/applications/harbormaster/phid/HarbormasterPHIDTypeBuild.php index 22f0c8bb62..0977134c7a 100644 --- a/src/applications/harbormaster/phid/HarbormasterPHIDTypeBuild.php +++ b/src/applications/harbormaster/phid/HarbormasterPHIDTypeBuild.php @@ -4,10 +4,6 @@ final class HarbormasterPHIDTypeBuild extends PhabricatorPHIDType { const TYPECONST = 'HMBD'; - public function getTypeConstant() { - return self::TYPECONST; - } - public function getTypeName() { return pht('Build'); } diff --git a/src/applications/harbormaster/phid/HarbormasterPHIDTypeBuildItem.php b/src/applications/harbormaster/phid/HarbormasterPHIDTypeBuildItem.php index 4d6fdb1982..83603ec079 100644 --- a/src/applications/harbormaster/phid/HarbormasterPHIDTypeBuildItem.php +++ b/src/applications/harbormaster/phid/HarbormasterPHIDTypeBuildItem.php @@ -4,10 +4,6 @@ final class HarbormasterPHIDTypeBuildItem extends PhabricatorPHIDType { const TYPECONST = 'HMBI'; - public function getTypeConstant() { - return self::TYPECONST; - } - public function getTypeName() { return pht('Build Item'); } diff --git a/src/applications/harbormaster/phid/HarbormasterPHIDTypeBuildLog.php b/src/applications/harbormaster/phid/HarbormasterPHIDTypeBuildLog.php index 385cbcaac6..2612d15556 100644 --- a/src/applications/harbormaster/phid/HarbormasterPHIDTypeBuildLog.php +++ b/src/applications/harbormaster/phid/HarbormasterPHIDTypeBuildLog.php @@ -4,10 +4,6 @@ final class HarbormasterPHIDTypeBuildLog extends PhabricatorPHIDType { const TYPECONST = 'HMCL'; - public function getTypeConstant() { - return self::TYPECONST; - } - public function getTypeName() { return pht('Build Log'); } diff --git a/src/applications/harbormaster/phid/HarbormasterPHIDTypeBuildPlan.php b/src/applications/harbormaster/phid/HarbormasterPHIDTypeBuildPlan.php index d5abaf8f0b..4449974422 100644 --- a/src/applications/harbormaster/phid/HarbormasterPHIDTypeBuildPlan.php +++ b/src/applications/harbormaster/phid/HarbormasterPHIDTypeBuildPlan.php @@ -4,10 +4,6 @@ final class HarbormasterPHIDTypeBuildPlan extends PhabricatorPHIDType { const TYPECONST = 'HMCP'; - public function getTypeConstant() { - return self::TYPECONST; - } - public function getTypeName() { return pht('Build Plan'); } diff --git a/src/applications/harbormaster/phid/HarbormasterPHIDTypeBuildStep.php b/src/applications/harbormaster/phid/HarbormasterPHIDTypeBuildStep.php index 3081f32e89..37500a0e73 100644 --- a/src/applications/harbormaster/phid/HarbormasterPHIDTypeBuildStep.php +++ b/src/applications/harbormaster/phid/HarbormasterPHIDTypeBuildStep.php @@ -4,10 +4,6 @@ final class HarbormasterPHIDTypeBuildStep extends PhabricatorPHIDType { const TYPECONST = 'HMCS'; - public function getTypeConstant() { - return self::TYPECONST; - } - public function getTypeName() { return pht('Build Step'); } diff --git a/src/applications/harbormaster/phid/HarbormasterPHIDTypeBuildTarget.php b/src/applications/harbormaster/phid/HarbormasterPHIDTypeBuildTarget.php index 7f893b77b7..fab5a58239 100644 --- a/src/applications/harbormaster/phid/HarbormasterPHIDTypeBuildTarget.php +++ b/src/applications/harbormaster/phid/HarbormasterPHIDTypeBuildTarget.php @@ -4,10 +4,6 @@ final class HarbormasterPHIDTypeBuildTarget extends PhabricatorPHIDType { const TYPECONST = 'HMBT'; - public function getTypeConstant() { - return self::TYPECONST; - } - public function getTypeName() { return pht('Build Target'); } diff --git a/src/applications/harbormaster/phid/HarbormasterPHIDTypeBuildable.php b/src/applications/harbormaster/phid/HarbormasterPHIDTypeBuildable.php index 6b05ec6d50..d88dfcfc5c 100644 --- a/src/applications/harbormaster/phid/HarbormasterPHIDTypeBuildable.php +++ b/src/applications/harbormaster/phid/HarbormasterPHIDTypeBuildable.php @@ -4,10 +4,6 @@ final class HarbormasterPHIDTypeBuildable extends PhabricatorPHIDType { const TYPECONST = 'HMBB'; - public function getTypeConstant() { - return self::TYPECONST; - } - public function getTypeName() { return pht('Buildable'); } diff --git a/src/applications/herald/adapter/HeraldPholioMockAdapter.php b/src/applications/herald/adapter/HeraldPholioMockAdapter.php index b3da0c63e3..26c1b0327e 100644 --- a/src/applications/herald/adapter/HeraldPholioMockAdapter.php +++ b/src/applications/herald/adapter/HeraldPholioMockAdapter.php @@ -103,7 +103,7 @@ final class HeraldPholioMockAdapter extends HeraldAdapter { case self::FIELD_PROJECTS: return PhabricatorEdgeQuery::loadDestinationPHIDs( $this->getMock()->getPHID(), - PhabricatorEdgeConfig::TYPE_OBJECT_HAS_PROJECT); + PhabricatorProjectObjectHasProjectEdgeType::EDGECONST); } return parent::getHeraldField($field); diff --git a/src/applications/herald/controller/HeraldRuleController.php b/src/applications/herald/controller/HeraldRuleController.php index 6bf1cb7c3f..83c91e5d07 100644 --- a/src/applications/herald/controller/HeraldRuleController.php +++ b/src/applications/herald/controller/HeraldRuleController.php @@ -596,14 +596,17 @@ final class HeraldRuleController extends HeraldController { 'arcanistprojects' => new DiffusionArcanistProjectDatasource(), 'package' => new PhabricatorOwnersPackageDatasource(), 'project' => new PhabricatorProjectDatasource(), + 'user' => new PhabricatorPeopleDatasource(), + 'email' => new PhabricatorMetaMTAMailableDatasource(), + 'userorproject' => new PhabricatorProjectOrUserDatasource(), ); - $sources = mpull($sources, 'getDatasourceURI'); - $sources += array( - 'email' => '/typeahead/common/mailable/', - 'user' => '/typeahead/common/accounts/', - 'userorproject' => '/typeahead/common/accountsorprojects/', - ); + foreach ($sources as $key => $source) { + $sources[$key] = array( + 'uri' => $source->getDatasourceURI(), + 'placeholder' => $source->getPlaceholderText(), + ); + } return array( 'source' => $sources, diff --git a/src/applications/herald/phid/HeraldPHIDTypeRule.php b/src/applications/herald/phid/HeraldPHIDTypeRule.php index 62b05c696d..3db09494dd 100644 --- a/src/applications/herald/phid/HeraldPHIDTypeRule.php +++ b/src/applications/herald/phid/HeraldPHIDTypeRule.php @@ -4,10 +4,6 @@ final class HeraldPHIDTypeRule extends PhabricatorPHIDType { const TYPECONST = 'HRUL'; - public function getTypeConstant() { - return self::TYPECONST; - } - public function getTypeName() { return pht('Herald Rule'); } diff --git a/src/applications/herald/query/HeraldRuleSearchEngine.php b/src/applications/herald/query/HeraldRuleSearchEngine.php index 4b009a113f..90fc510b62 100644 --- a/src/applications/herald/query/HeraldRuleSearchEngine.php +++ b/src/applications/herald/query/HeraldRuleSearchEngine.php @@ -71,7 +71,7 @@ final class HeraldRuleSearchEngine $form ->appendChild( id(new AphrontFormTokenizerControl()) - ->setDatasource('/typeahead/common/users/') + ->setDatasource(new PhabricatorPeopleDatasource()) ->setName('authors') ->setLabel(pht('Authors')) ->setValue($author_handles)) diff --git a/src/applications/herald/storage/HeraldRule.php b/src/applications/herald/storage/HeraldRule.php index 15e85646ed..6245f70d8f 100644 --- a/src/applications/herald/storage/HeraldRule.php +++ b/src/applications/herald/storage/HeraldRule.php @@ -4,7 +4,7 @@ final class HeraldRule extends HeraldDAO implements PhabricatorFlaggableInterface, PhabricatorPolicyInterface, - PhabricatorDestructableInterface { + PhabricatorDestructibleInterface { const TABLE_RULE_APPLIED = 'herald_ruleapplied'; @@ -252,7 +252,7 @@ final class HeraldRule extends HeraldDAO } -/* -( PhabricatorDestructableInterface )----------------------------------- */ +/* -( PhabricatorDestructibleInterface )----------------------------------- */ public function destroyObjectPermanently( PhabricatorDestructionEngine $engine) { diff --git a/src/applications/legalpad/controller/LegalpadDocumentSignatureAddController.php b/src/applications/legalpad/controller/LegalpadDocumentSignatureAddController.php index e85e7a70c7..47ad308508 100644 --- a/src/applications/legalpad/controller/LegalpadDocumentSignatureAddController.php +++ b/src/applications/legalpad/controller/LegalpadDocumentSignatureAddController.php @@ -130,7 +130,7 @@ final class LegalpadDocumentSignatureAddController extends LegalpadController { ->setLabel(pht('Exempt User')) ->setName('users') ->setLimit(1) - ->setDatasource('/typeahead/common/users/') + ->setDatasource(new PhabricatorPeopleDatasource()) ->setValue($user_handles) ->setError($e_user)); } else { diff --git a/src/applications/legalpad/editor/LegalpadDocumentEditor.php b/src/applications/legalpad/editor/LegalpadDocumentEditor.php index c8904b0d42..8ab21daf9d 100644 --- a/src/applications/legalpad/editor/LegalpadDocumentEditor.php +++ b/src/applications/legalpad/editor/LegalpadDocumentEditor.php @@ -105,7 +105,6 @@ final class LegalpadDocumentEditor $type = PhabricatorEdgeConfig::TYPE_CONTRIBUTED_TO_OBJECT; id(new PhabricatorEdgeEditor()) ->addEdge($actor->getPHID(), $type, $object->getPHID()) - ->setActor($actor) ->save(); $type = PhabricatorEdgeConfig::TYPE_OBJECT_HAS_CONTRIBUTOR; diff --git a/src/applications/legalpad/phid/PhabricatorLegalpadPHIDTypeDocument.php b/src/applications/legalpad/phid/PhabricatorLegalpadPHIDTypeDocument.php index 58cdc582fc..f187ee335f 100644 --- a/src/applications/legalpad/phid/PhabricatorLegalpadPHIDTypeDocument.php +++ b/src/applications/legalpad/phid/PhabricatorLegalpadPHIDTypeDocument.php @@ -4,10 +4,6 @@ final class PhabricatorLegalpadPHIDTypeDocument extends PhabricatorPHIDType { const TYPECONST = 'LEGD'; - public function getTypeConstant() { - return self::TYPECONST; - } - public function getTypeName() { return pht('Legalpad Document'); } diff --git a/src/applications/legalpad/query/LegalpadDocumentSearchEngine.php b/src/applications/legalpad/query/LegalpadDocumentSearchEngine.php index 9480273c7b..d80386b815 100644 --- a/src/applications/legalpad/query/LegalpadDocumentSearchEngine.php +++ b/src/applications/legalpad/query/LegalpadDocumentSearchEngine.php @@ -95,13 +95,13 @@ final class LegalpadDocumentSearchEngine ->setDisabled(!$this->requireViewer()->getPHID())) ->appendChild( id(new AphrontFormTokenizerControl()) - ->setDatasource('/typeahead/common/users/') + ->setDatasource(new PhabricatorPeopleDatasource()) ->setName('creators') ->setLabel(pht('Creators')) ->setValue(array_select_keys($handles, $creator_phids))) ->appendChild( id(new AphrontFormTokenizerControl()) - ->setDatasource('/typeahead/common/users/') + ->setDatasource(new PhabricatorPeopleDatasource()) ->setName('contributors') ->setLabel(pht('Contributors')) ->setValue(array_select_keys($handles, $contributor_phids))); diff --git a/src/applications/legalpad/query/LegalpadDocumentSignatureSearchEngine.php b/src/applications/legalpad/query/LegalpadDocumentSignatureSearchEngine.php index 2883c6bbef..da1d792998 100644 --- a/src/applications/legalpad/query/LegalpadDocumentSignatureSearchEngine.php +++ b/src/applications/legalpad/query/LegalpadDocumentSignatureSearchEngine.php @@ -99,7 +99,7 @@ final class LegalpadDocumentSignatureSearchEngine $form ->appendChild( id(new AphrontFormTokenizerControl()) - ->setDatasource('/typeahead/common/users/') + ->setDatasource(new PhabricatorPeopleDatasource()) ->setName('signers') ->setLabel(pht('Signers')) ->setValue(array_select_keys($handles, $signer_phids))) diff --git a/src/applications/legalpad/storage/LegalpadDocument.php b/src/applications/legalpad/storage/LegalpadDocument.php index 2adaa42263..77f2be7cc4 100644 --- a/src/applications/legalpad/storage/LegalpadDocument.php +++ b/src/applications/legalpad/storage/LegalpadDocument.php @@ -5,7 +5,7 @@ final class LegalpadDocument extends LegalpadDAO PhabricatorPolicyInterface, PhabricatorSubscribableInterface, PhabricatorApplicationTransactionInterface, - PhabricatorDestructableInterface { + PhabricatorDestructibleInterface { protected $title; protected $contributorCount; @@ -201,7 +201,7 @@ final class LegalpadDocument extends LegalpadDAO } -/* -( PhabricatorDestructableInterface )----------------------------------- */ +/* -( PhabricatorDestructibleInterface )----------------------------------- */ public function destroyObjectPermanently( diff --git a/src/applications/legalpad/typeahead/LegalpadDocumentDatasource.php b/src/applications/legalpad/typeahead/LegalpadDocumentDatasource.php index e266dca640..ccb527dfa0 100644 --- a/src/applications/legalpad/typeahead/LegalpadDocumentDatasource.php +++ b/src/applications/legalpad/typeahead/LegalpadDocumentDatasource.php @@ -23,7 +23,6 @@ final class LegalpadDocumentDatasource foreach ($documents as $document) { $results[] = id(new PhabricatorTypeaheadResult()) ->setPHID($document->getPHID()) - ->setIcon('fa-file-text-o') ->setName($document->getMonogram().' '.$document->getTitle()); } diff --git a/src/applications/macro/phid/PhabricatorMacroPHIDTypeMacro.php b/src/applications/macro/phid/PhabricatorMacroPHIDTypeMacro.php index 3c9aeb3ea0..9c883b77ab 100644 --- a/src/applications/macro/phid/PhabricatorMacroPHIDTypeMacro.php +++ b/src/applications/macro/phid/PhabricatorMacroPHIDTypeMacro.php @@ -4,10 +4,6 @@ final class PhabricatorMacroPHIDTypeMacro extends PhabricatorPHIDType { const TYPECONST = 'MCRO'; - public function getTypeConstant() { - return self::TYPECONST; - } - public function getTypeName() { return pht('Image Macro'); } diff --git a/src/applications/macro/query/PhabricatorMacroSearchEngine.php b/src/applications/macro/query/PhabricatorMacroSearchEngine.php index c6af71ede2..9abf99d3aa 100644 --- a/src/applications/macro/query/PhabricatorMacroSearchEngine.php +++ b/src/applications/macro/query/PhabricatorMacroSearchEngine.php @@ -93,7 +93,7 @@ final class PhabricatorMacroSearchEngine ->setValue($status)) ->appendChild( id(new AphrontFormTokenizerControl()) - ->setDatasource('/typeahead/common/users/') + ->setDatasource(new PhabricatorPeopleDatasource()) ->setName('authors') ->setLabel(pht('Authors')) ->setValue($author_handles)) diff --git a/src/applications/macro/typeahead/PhabricatorMacroDatasource.php b/src/applications/macro/typeahead/PhabricatorMacroDatasource.php index a6c84d9cce..6b7078b410 100644 --- a/src/applications/macro/typeahead/PhabricatorMacroDatasource.php +++ b/src/applications/macro/typeahead/PhabricatorMacroDatasource.php @@ -25,8 +25,7 @@ final class PhabricatorMacroDatasource foreach ($macros as $macro) { $results[] = id(new PhabricatorTypeaheadResult()) ->setPHID($macro->getPHID()) - ->setName($macro->getName()) - ->setIcon('fa-meh-o bluegrey'); + ->setName($macro->getName()); } return $results; diff --git a/src/applications/mailinglists/phid/PhabricatorMailingListPHIDTypeList.php b/src/applications/mailinglists/phid/PhabricatorMailingListPHIDTypeList.php index df814dfa3a..6f0c0de0fb 100644 --- a/src/applications/mailinglists/phid/PhabricatorMailingListPHIDTypeList.php +++ b/src/applications/mailinglists/phid/PhabricatorMailingListPHIDTypeList.php @@ -4,14 +4,14 @@ final class PhabricatorMailingListPHIDTypeList extends PhabricatorPHIDType { const TYPECONST = 'MLST'; - public function getTypeConstant() { - return self::TYPECONST; - } - public function getTypeName() { return pht('Mailing List'); } + public function getTypeIcon() { + return 'fa-envelope-o'; + } + public function newObject() { return new PhabricatorMetaMTAMailingList(); } diff --git a/src/applications/mailinglists/storage/PhabricatorMetaMTAMailingList.php b/src/applications/mailinglists/storage/PhabricatorMetaMTAMailingList.php index b24ca55185..e506815a0f 100644 --- a/src/applications/mailinglists/storage/PhabricatorMetaMTAMailingList.php +++ b/src/applications/mailinglists/storage/PhabricatorMetaMTAMailingList.php @@ -1,7 +1,9 @@ openTransaction(); + $this->delete(); + $this->saveTransaction(); + } + } diff --git a/src/applications/mailinglists/typeahead/PhabricatorMailingListDatasource.php b/src/applications/mailinglists/typeahead/PhabricatorMailingListDatasource.php new file mode 100644 index 0000000000..48f5b83da7 --- /dev/null +++ b/src/applications/mailinglists/typeahead/PhabricatorMailingListDatasource.php @@ -0,0 +1,33 @@ +getViewer(); + $raw_query = $this->getRawQuery(); + + $results = array(); + + $lists = id(new PhabricatorMailingListQuery()) + ->setViewer($viewer) + ->execute(); + foreach ($lists as $list) { + $results[] = id(new PhabricatorTypeaheadResult()) + ->setName($list->getName()) + ->setURI($list->getURI()) + ->setPHID($list->getPHID()); + } + + return $results; + } + +} diff --git a/src/applications/maniphest/conduit/ConduitAPI_maniphest_Method.php b/src/applications/maniphest/conduit/ConduitAPI_maniphest_Method.php index b2dd625bfc..d45c42dc88 100644 --- a/src/applications/maniphest/conduit/ConduitAPI_maniphest_Method.php +++ b/src/applications/maniphest/conduit/ConduitAPI_maniphest_Method.php @@ -116,18 +116,27 @@ abstract class ConduitAPI_maniphest_Method extends ConduitAPIMethod { $changes[ManiphestTransaction::TYPE_CCS] = $ccs; } + $transactions = array(); + $project_phids = $request->getValue('projectPHIDs'); if ($project_phids !== null) { $this->validatePHIDList( $project_phids, PhabricatorProjectPHIDTypeProject::TYPECONST, 'projectPHIDS'); - $changes[ManiphestTransaction::TYPE_PROJECTS] = $project_phids; + + $project_type = PhabricatorProjectObjectHasProjectEdgeType::EDGECONST; + $transactions[] = id(new ManiphestTransaction()) + ->setTransactionType(PhabricatorTransactions::TYPE_EDGE) + ->setMetadataValue('edge:type', $project_type) + ->setNewValue( + array( + '=' => array_fuse($project_phids), + )); } $template = new ManiphestTransaction(); - $transactions = array(); foreach ($changes as $type => $value) { $transaction = clone $template; $transaction->setTransactionType($type); diff --git a/src/applications/maniphest/controller/ManiphestBatchEditController.php b/src/applications/maniphest/controller/ManiphestBatchEditController.php index fbcb84884b..0488000b3a 100644 --- a/src/applications/maniphest/controller/ManiphestBatchEditController.php +++ b/src/applications/maniphest/controller/ManiphestBatchEditController.php @@ -62,6 +62,8 @@ final class ManiphestBatchEditController extends ManiphestController { $template = $template->render(); $projects_source = new PhabricatorProjectDatasource(); + $mailable_source = new PhabricatorMetaMTAMailableDatasource(); + $owner_source = new PhabricatorTypeaheadOwnerDatasource(); require_celerity_resource('maniphest-batch-editor'); Javelin::initBehavior( @@ -75,14 +77,13 @@ final class ManiphestBatchEditController extends ManiphestController { 'placeholder' => $projects_source->getPlaceholderText(), ), 'owner' => array( - 'src' => '/typeahead/common/searchowner/', - 'placeholder' => pht( - 'Type a user name or "upforgrabs" to unassign...'), + 'src' => $owner_source->getDatasourceURI(), + 'placeholder' => $owner_source->getPlaceholderText(), 'limit' => 1, ), 'cc' => array( - 'src' => '/typeahead/common/mailable/', - 'placeholder' => pht('Type a user name...'), + 'src' => $mailable_source->getDatasourceURI(), + 'placeholder' => $mailable_source->getPlaceholderText(), ) ), 'input' => 'batch-form-actions', @@ -324,6 +325,18 @@ final class ManiphestBatchEditController extends ManiphestController { id(new ManiphestTransactionComment()) ->setContent($value)); break; + case ManiphestTransaction::TYPE_PROJECTS: + + // TODO: Clean this mess up. + $project_type = PhabricatorProjectObjectHasProjectEdgeType::EDGECONST; + $xaction + ->setTransactionType(PhabricatorTransactions::TYPE_EDGE) + ->setMetadataValue('edge:type', $project_type) + ->setNewValue( + array( + '=' => array_fuse($value), + )); + break; default: $xaction->setNewValue($value); break; diff --git a/src/applications/maniphest/controller/ManiphestReportController.php b/src/applications/maniphest/controller/ManiphestReportController.php index ef454982fd..bace59358a 100644 --- a/src/applications/maniphest/controller/ManiphestReportController.php +++ b/src/applications/maniphest/controller/ManiphestReportController.php @@ -84,9 +84,10 @@ final class ManiphestReportController extends ManiphestController { $joins = qsprintf( $conn, 'JOIN %T t ON x.objectPHID = t.phid - JOIN %T p ON p.taskPHID = t.phid AND p.projectPHID = %s', + JOIN %T p ON p.src = t.phid AND p.type = %d AND p.dst = %s', id(new ManiphestTask())->getTableName(), - id(new ManiphestTaskProject())->getTableName(), + PhabricatorEdgeConfig::TABLE_NAME_EDGE, + PhabricatorProjectObjectHasProjectEdgeType::EDGECONST, $project_phid); } @@ -321,7 +322,7 @@ final class ManiphestReportController extends ManiphestController { ->setUser($user) ->appendChild( id(new AphrontFormTokenizerControl()) - ->setDatasource('/typeahead/common/searchproject/') + ->setDatasource(new PhabricatorProjectDatasource()) ->setLabel(pht('Project')) ->setLimit(1) ->setName('set_project') diff --git a/src/applications/maniphest/controller/ManiphestTaskDetailController.php b/src/applications/maniphest/controller/ManiphestTaskDetailController.php index be45a0e754..5c632b8207 100644 --- a/src/applications/maniphest/controller/ManiphestTaskDetailController.php +++ b/src/applications/maniphest/controller/ManiphestTaskDetailController.php @@ -52,10 +52,10 @@ final class ManiphestTaskDetailController extends ManiphestController { ->setViewer($user) ->readFieldsFromStorage($task); - $e_commit = PhabricatorEdgeConfig::TYPE_TASK_HAS_COMMIT; + $e_commit = ManiphestTaskHasCommitEdgeType::EDGECONST; $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 = ManiphestTaskHasRevisionEdgeType::EDGECONST; $e_mock = PhabricatorEdgeConfig::TYPE_TASK_HAS_MOCK; $phid = $task->getPHID(); @@ -284,6 +284,8 @@ final class ManiphestTaskDetailController extends ManiphestController { ); $projects_source = new PhabricatorProjectDatasource(); + $users_source = new PhabricatorPeopleDatasource(); + $mailable_source = new PhabricatorMetaMTAMailableDatasource(); $tokenizer_map = array( ManiphestTransaction::TYPE_PROJECTS => array( @@ -293,15 +295,15 @@ final class ManiphestTaskDetailController extends ManiphestController { ), ManiphestTransaction::TYPE_OWNER => array( 'id' => 'assign-tokenizer', - 'src' => '/typeahead/common/users/', + 'src' => $users_source->getDatasourceURI(), 'value' => $default_claim, 'limit' => 1, - 'placeholder' => pht('Type a user name...'), + 'placeholder' => $users_source->getPlaceholderText(), ), ManiphestTransaction::TYPE_CCS => array( 'id' => 'cc-tokenizer', - 'src' => '/typeahead/common/mailable/', - 'placeholder' => pht('Type a user or mailing list...'), + 'src' => $mailable_source->getDatasourceURI(), + 'placeholder' => $mailable_source->getPlaceholderText(), ), ); @@ -591,20 +593,20 @@ final class ManiphestTaskDetailController extends ManiphestController { $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'), + ManiphestTaskHasRevisionEdgeType::EDGECONST + => pht('Differential Revisions'), PhabricatorEdgeConfig::TYPE_TASK_HAS_MOCK - => pht('Pholio Mocks'), + => pht('Pholio Mocks'), ); $revisions_commits = array(); $handles = $this->getLoadedHandles(); $commit_phids = array_keys( - $edges[PhabricatorEdgeConfig::TYPE_TASK_HAS_COMMIT]); + $edges[ManiphestTaskHasCommitEdgeType::EDGECONST]); if ($commit_phids) { $commit_drev = PhabricatorEdgeConfig::TYPE_COMMIT_HAS_DREV; $drev_edges = id(new PhabricatorEdgeQuery()) @@ -617,7 +619,7 @@ final class ManiphestTaskDetailController extends ManiphestController { $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 = ManiphestTaskHasRevisionEdgeType::EDGECONST; unset($edges[$task_drev][$revision_phid]); $revisions_commits[$phid] = hsprintf( '%s / %s', diff --git a/src/applications/maniphest/controller/ManiphestTaskEditController.php b/src/applications/maniphest/controller/ManiphestTaskEditController.php index 8a693a916c..36ec1b98e8 100644 --- a/src/applications/maniphest/controller/ManiphestTaskEditController.php +++ b/src/applications/maniphest/controller/ManiphestTaskEditController.php @@ -81,7 +81,6 @@ final class ManiphestTaskEditController extends ManiphestController { ->withNames($tokens) ->execute(); $default_projects = mpull($default_projects, 'getPHID'); - } $project_key = $request->getStr('project'); @@ -95,7 +94,7 @@ final class ManiphestTaskEditController extends ManiphestController { } if ($default_projects) { - $task->setProjectPHIDs($default_projects); + $task->attachProjectPHIDs($default_projects); } } @@ -228,7 +227,7 @@ final class ManiphestTaskEditController extends ManiphestController { $task->setPriority($request->getInt('priority')); $task->setOwnerPHID($owner_phid); $task->setCCPHIDs($request->getArr('cc')); - $task->setProjectPHIDs($request->getArr('projects')); + $task->attachProjectPHIDs($request->getArr('projects')); } else { if ($can_edit_priority) { @@ -282,6 +281,17 @@ final class ManiphestTaskEditController extends ManiphestController { if ($type == ManiphestTransaction::TYPE_PROJECT_COLUMN) { $transaction->setNewValue($value['new']); $transaction->setOldValue($value['old']); + } else if ($type == ManiphestTransaction::TYPE_PROJECTS) { + // TODO: Gross. + $project_type = + PhabricatorProjectObjectHasProjectEdgeType::EDGECONST; + $transaction + ->setTransactionType(PhabricatorTransactions::TYPE_EDGE) + ->setMetadataValue('edge:type', $project_type) + ->setNewValue( + array( + '=' => array_fuse($value), + )); } else { $transaction->setNewValue($value); } @@ -343,7 +353,6 @@ final class ManiphestTaskEditController extends ManiphestController { if ($parent_task) { id(new PhabricatorEdgeEditor()) - ->setActor($user) ->addEdge( $parent_task->getPHID(), PhabricatorEdgeConfig::TYPE_TASK_DEPENDS_ON_TASK, @@ -452,7 +461,7 @@ final class ManiphestTaskEditController extends ManiphestController { ->executeOne(); if ($template_task) { $task->setCCPHIDs($template_task->getCCPHIDs()); - $task->setProjectPHIDs($template_task->getProjectPHIDs()); + $task->attachProjectPHIDs($template_task->getProjectPHIDs()); $task->setOwnerPHID($template_task->getOwnerPHID()); $task->setPriority($template_task->getPriority()); $task->setViewPolicy($template_task->getViewPolicy()); @@ -663,7 +672,7 @@ final class ManiphestTaskEditController extends ManiphestController { ->setName('assigned_to') ->setValue($assigned_value) ->setUser($user) - ->setDatasource('/typeahead/common/users/') + ->setDatasource(new PhabricatorPeopleDatasource()) ->setLimit(1)); } @@ -681,7 +690,7 @@ final class ManiphestTaskEditController extends ManiphestController { ->setName('cc') ->setValue($cc_value) ->setUser($user) - ->setDatasource('/typeahead/common/mailable/') + ->setDatasource(new PhabricatorMetaMTAMailableDatasource()) ->setHidden($creating_for_project)); if ($can_edit_priority) { @@ -735,7 +744,7 @@ final class ManiphestTaskEditController extends ManiphestController { ->setValue($projects_value) ->setID($project_tokenizer_id) ->setCaption($projects_caption) - ->setDatasource('/typeahead/common/projects/')); + ->setDatasource(new PhabricatorMetaMTAMailableDatasource())); } foreach ($aux_fields as $aux_field) { diff --git a/src/applications/maniphest/controller/ManiphestTransactionPreviewController.php b/src/applications/maniphest/controller/ManiphestTransactionPreviewController.php index 66d7298e81..1a58f68ff5 100644 --- a/src/applications/maniphest/controller/ManiphestTransactionPreviewController.php +++ b/src/applications/maniphest/controller/ManiphestTransactionPreviewController.php @@ -84,14 +84,19 @@ final class ManiphestTransactionPreviewController extends ManiphestController { $value = array(); } - $phids = $value; - foreach ($task->getProjectPHIDs() as $project_phid) { + $phids = array(); + $value = array_fuse($value); + foreach ($value as $project_phid) { $phids[] = $project_phid; - $value[] = $project_phid; + $value[$project_phid] = array('dst' => $project_phid); } - $transaction->setOldValue($task->getProjectPHIDs()); - $transaction->setNewValue($value); + $project_type = PhabricatorProjectObjectHasProjectEdgeType::EDGECONST; + $transaction + ->setTransactionType(PhabricatorTransactions::TYPE_EDGE) + ->setMetadataValue('edge:type', $project_type) + ->setOldValue(array()) + ->setNewValue($value); break; case ManiphestTransaction::TYPE_STATUS: $phids = array(); diff --git a/src/applications/maniphest/controller/ManiphestTransactionSaveController.php b/src/applications/maniphest/controller/ManiphestTransactionSaveController.php index 34e2f57f37..a11149982b 100644 --- a/src/applications/maniphest/controller/ManiphestTransactionSaveController.php +++ b/src/applications/maniphest/controller/ManiphestTransactionSaveController.php @@ -53,7 +53,16 @@ final class ManiphestTransactionSaveController extends ManiphestController { $projects = array_merge($projects, $task->getProjectPHIDs()); $projects = array_filter($projects); $projects = array_unique($projects); - $transaction->setNewValue($projects); + + // TODO: Bleh. + $project_type = PhabricatorProjectObjectHasProjectEdgeType::EDGECONST; + $transaction + ->setTransactionType(PhabricatorTransactions::TYPE_EDGE) + ->setMetadataValue('edge:type', $project_type) + ->setNewValue( + array( + '+' => array_fuse($projects), + )); break; case ManiphestTransaction::TYPE_CCS: // Accumulate the new explicit CCs into the array that we'll add in diff --git a/src/applications/maniphest/edge/ManiphestTaskHasCommitEdgeType.php b/src/applications/maniphest/edge/ManiphestTaskHasCommitEdgeType.php new file mode 100644 index 0000000000..a9842f8ff1 --- /dev/null +++ b/src/applications/maniphest/edge/ManiphestTaskHasCommitEdgeType.php @@ -0,0 +1,103 @@ +getOwnerPHID(), null); case ManiphestTransaction::TYPE_CCS: return array_values(array_unique($object->getCCPHIDs())); - case ManiphestTransaction::TYPE_PROJECTS: - return array_values(array_unique($object->getProjectPHIDs())); - case ManiphestTransaction::TYPE_EDGE: case ManiphestTransaction::TYPE_PROJECT_COLUMN: // These are pre-populated. return $xaction->getOldValue(); @@ -75,14 +71,12 @@ final class ManiphestTransactionEditor case ManiphestTransaction::TYPE_PRIORITY: return (int)$xaction->getNewValue(); case ManiphestTransaction::TYPE_CCS: - case ManiphestTransaction::TYPE_PROJECTS: return array_values(array_unique($xaction->getNewValue())); case ManiphestTransaction::TYPE_OWNER: return nonempty($xaction->getNewValue(), null); case ManiphestTransaction::TYPE_STATUS: case ManiphestTransaction::TYPE_TITLE: case ManiphestTransaction::TYPE_DESCRIPTION: - case ManiphestTransaction::TYPE_EDGE: case ManiphestTransaction::TYPE_SUBPRIORITY: case ManiphestTransaction::TYPE_PROJECT_COLUMN: case ManiphestTransaction::TYPE_UNBLOCK: @@ -99,7 +93,6 @@ final class ManiphestTransactionEditor $new = $xaction->getNewValue(); switch ($xaction->getTransactionType()) { - case ManiphestTransaction::TYPE_PROJECTS: case ManiphestTransaction::TYPE_CCS: sort($old); sort($new); @@ -151,12 +144,6 @@ final class ManiphestTransactionEditor return $object->setOwnerPHID($phid); case ManiphestTransaction::TYPE_CCS: return $object->setCCPHIDs($xaction->getNewValue()); - case ManiphestTransaction::TYPE_PROJECTS: - return $object->setProjectPHIDs($xaction->getNewValue()); - case ManiphestTransaction::TYPE_EDGE: - // These are a weird, funky mess and are already being applied by the - // time we reach this. - return; case ManiphestTransaction::TYPE_SUBPRIORITY: $data = $xaction->getNewValue(); $new_sub = $this->getNextSubpriority( @@ -229,10 +216,7 @@ final class ManiphestTransactionEditor return; } - $editor = id(new PhabricatorEdgeEditor()) - ->setActor($this->getActor()) - ->setSuppressEvents(true); - + $editor = new PhabricatorEdgeEditor(); foreach ($add as $phid) { $editor->addEdge($src, $edge_type, $phid); } @@ -415,19 +399,6 @@ final class ManiphestTransactionEditor $existing_cc = $object->getCCPHIDs(); $new_cc = array_unique(array_merge($cc_phids, $existing_cc)); $object->setCCPHIDs($new_cc); - $save_again = true; - } - - $project_phids = $adapter->getProjectPHIDs(); - if ($project_phids) { - $existing_projects = $object->getProjectPHIDs(); - $new_projects = array_unique( - array_merge($project_phids, $existing_projects)); - $object->setProjectPHIDs($new_projects); - $save_again = true; - } - - if ($save_again) { $object->save(); } @@ -442,6 +413,18 @@ final class ManiphestTransactionEditor ->setNewValue($assign_phid); } + $project_phids = $adapter->getProjectPHIDs(); + if ($project_phids) { + $project_type = PhabricatorProjectObjectHasProjectEdgeType::EDGECONST; + $xactions[] = id(new ManiphestTransaction()) + ->setTransactionType(PhabricatorTransactions::TYPE_EDGE) + ->setMetadataValue('edge:type', $project_type) + ->setNewValue( + array( + '+' => array_fuse($project_phids), + )); + } + return $xactions; } @@ -456,8 +439,6 @@ final class ManiphestTransactionEditor ManiphestCapabilityEditPriority::CAPABILITY, ManiphestTransaction::TYPE_STATUS => ManiphestCapabilityEditStatus::CAPABILITY, - ManiphestTransaction::TYPE_PROJECTS => - ManiphestCapabilityEditProjects::CAPABILITY, ManiphestTransaction::TYPE_OWNER => ManiphestCapabilityEditAssign::CAPABILITY, PhabricatorTransactions::TYPE_EDIT_POLICY => @@ -466,8 +447,19 @@ final class ManiphestTransactionEditor ManiphestCapabilityEditPolicies::CAPABILITY, ); + $transaction_type = $xaction->getTransactionType(); - $app_capability = idx($app_capability_map, $transaction_type); + + $app_capability = null; + if ($transaction_type == PhabricatorTransactions::TYPE_EDGE) { + switch ($xaction->getMetadataValue('edge:type')) { + case PhabricatorProjectObjectHasProjectEdgeType::EDGECONST: + $app_capability = ManiphestCapabilityEditProjects::CAPABILITY; + break; + } + } else { + $app_capability = idx($app_capability_map, $transaction_type); + } if ($app_capability) { $app = id(new PhabricatorApplicationQuery()) diff --git a/src/applications/maniphest/event/ManiphestEdgeEventListener.php b/src/applications/maniphest/event/ManiphestEdgeEventListener.php deleted file mode 100644 index 8e2552d110..0000000000 --- a/src/applications/maniphest/event/ManiphestEdgeEventListener.php +++ /dev/null @@ -1,137 +0,0 @@ -listen(PhabricatorEventType::TYPE_EDGE_WILLEDITEDGES); - $this->listen(PhabricatorEventType::TYPE_EDGE_DIDEDITEDGES); - } - - public function handleEvent(PhutilEvent $event) { - switch ($event->getType()) { - case PhabricatorEventType::TYPE_EDGE_WILLEDITEDGES: - return $this->handleWillEditEvent($event); - case PhabricatorEventType::TYPE_EDGE_DIDEDITEDGES: - return $this->handleDidEditEvent($event); - } - } - - private function handleWillEditEvent(PhutilEvent $event) { - // NOTE: Everything is namespaced by `id` so that we aren't left in an - // inconsistent state if an edit fails to complete (e.g., something throws) - // or an edit happens inside another edit. - - $id = $event->getValue('id'); - - $edges = $this->loadAllEdges($event); - $tasks = array(); - if ($edges) { - // TODO: T603 This should probably all get nuked. Until then, this isn't - // realllllly a policy issue since callers are (or should be) doing - // policy checks anyway. - $tasks = id(new ManiphestTask())->loadAllWhere( - 'phid IN (%Ls)', - array_keys($edges)); - $tasks = mpull($tasks, null, 'getPHID'); - } - - $this->edges[$id] = $edges; - $this->tasks[$id] = $tasks; - } - - private function handleDidEditEvent(PhutilEvent $event) { - $id = $event->getValue('id'); - - $old_edges = $this->edges[$id]; - $tasks = $this->tasks[$id]; - - unset($this->edges[$id]); - unset($this->tasks[$id]); - - $content_source = PhabricatorContentSource::newForSource( - PhabricatorContentSource::SOURCE_LEGACY, - array()); - - $new_edges = $this->loadAllEdges($event); - $editor = id(new ManiphestTransactionEditor()) - ->setActor($event->getUser()) - ->setContentSource($content_source) - ->setContinueOnNoEffect(true) - ->setContinueOnMissingFields(true); - - foreach ($tasks as $phid => $task) { - $xactions = array(); - - $old = $old_edges[$phid]; - $new = $new_edges[$phid]; - - $types = array_keys($old + $new); - foreach ($types as $type) { - $old_type = idx($old, $type, array()); - $new_type = idx($new, $type, array()); - - if ($old_type === $new_type) { - continue; - } - - $xactions[] = id(new ManiphestTransaction()) - ->setTransactionType(ManiphestTransaction::TYPE_EDGE) - ->setOldValue($old_type) - ->setNewValue($new_type) - ->setMetadataValue('edge:type', $type); - } - - if ($xactions) { - $editor->applyTransactions($task, $xactions); - } - } - } - - private function filterEdgesBySourceType(array $edges, $type) { - foreach ($edges as $key => $edge) { - if ($edge['src_type'] !== $type) { - unset($edges[$key]); - } - } - return $edges; - } - - private function loadAllEdges(PhutilEvent $event) { - $add_edges = $event->getValue('add'); - $rem_edges = $event->getValue('rem'); - - $type_task = ManiphestPHIDTypeTask::TYPECONST; - - $all_edges = array_merge($add_edges, $rem_edges); - $all_edges = $this->filterEdgesBySourceType($all_edges, $type_task); - - if (!$all_edges) { - return; - } - - $all_tasks = array(); - $all_types = array(); - foreach ($all_edges as $edge) { - $all_tasks[$edge['src']] = true; - $all_types[$edge['type']] = true; - } - - $all_tasks = array_keys($all_tasks); - $all_types = array_keys($all_types); - - return id(new PhabricatorEdgeQuery()) - ->withSourcePHIDs($all_tasks) - ->withEdgeTypes($all_types) - ->needEdgeData(true) - ->execute(); - } - -} diff --git a/src/applications/maniphest/lipsum/PhabricatorManiphestTaskTestDataGenerator.php b/src/applications/maniphest/lipsum/PhabricatorManiphestTaskTestDataGenerator.php index e4211dc9c9..a3d27ca1c3 100644 --- a/src/applications/maniphest/lipsum/PhabricatorManiphestTaskTestDataGenerator.php +++ b/src/applications/maniphest/lipsum/PhabricatorManiphestTaskTestDataGenerator.php @@ -30,8 +30,6 @@ final class PhabricatorManiphestTaskTestDataGenerator $this->generateTaskPriority(); $changes[ManiphestTransaction::TYPE_CCS] = $this->getCCPHIDs(); - $changes[ManiphestTransaction::TYPE_PROJECTS] = - $this->getProjectPHIDs(); $transactions = array(); foreach ($changes as $type => $value) { $transaction = clone $template; diff --git a/src/applications/maniphest/phid/ManiphestPHIDTypeTask.php b/src/applications/maniphest/phid/ManiphestPHIDTypeTask.php index 732ac82260..093c6aa388 100644 --- a/src/applications/maniphest/phid/ManiphestPHIDTypeTask.php +++ b/src/applications/maniphest/phid/ManiphestPHIDTypeTask.php @@ -4,10 +4,6 @@ final class ManiphestPHIDTypeTask extends PhabricatorPHIDType { const TYPECONST = 'TASK'; - public function getTypeConstant() { - return self::TYPECONST; - } - public function getTypeName() { return pht('Task'); } diff --git a/src/applications/maniphest/query/ManiphestTaskQuery.php b/src/applications/maniphest/query/ManiphestTaskQuery.php index 04c8ec0385..1f75c91fbc 100644 --- a/src/applications/maniphest/query/ManiphestTaskQuery.php +++ b/src/applications/maniphest/query/ManiphestTaskQuery.php @@ -205,28 +205,28 @@ final class ManiphestTaskQuery extends PhabricatorCursorPagedPolicyAwareQuery { if ($this->dateCreatedAfter) { $where[] = qsprintf( $conn, - 'dateCreated >= %d', + 'task.dateCreated >= %d', $this->dateCreatedAfter); } if ($this->dateCreatedBefore) { $where[] = qsprintf( $conn, - 'dateCreated <= %d', + 'task.dateCreated <= %d', $this->dateCreatedBefore); } if ($this->dateModifiedAfter) { $where[] = qsprintf( $conn, - 'dateModified >= %d', + 'task.dateModified >= %d', $this->dateModifiedAfter); } if ($this->dateModifiedBefore) { $where[] = qsprintf( $conn, - 'dateModified <= %d', + 'task.dateModified <= %d', $this->dateModifiedBefore); } @@ -242,7 +242,7 @@ final class ManiphestTaskQuery extends PhabricatorCursorPagedPolicyAwareQuery { // query. We sum the project count and require it be the same as the // number of projects we're searching for. - $count = ', COUNT(project.projectPHID) projectCount'; + $count = ', COUNT(project.dst) projectCount'; $having = qsprintf( $conn, 'HAVING projectCount = %d', @@ -358,6 +358,27 @@ final class ManiphestTaskQuery extends PhabricatorCursorPagedPolicyAwareQuery { return $tasks; } + protected function didFilterPage(array $tasks) { + // TODO: Eventually, we should make this optional and introduce a + // needProjectPHIDs() method, but for now there's a lot of code which + // assumes the data is always populated. + + $edge_query = id(new PhabricatorEdgeQuery()) + ->withSourcePHIDs(mpull($tasks, 'getPHID')) + ->withEdgeTypes( + array( + PhabricatorProjectObjectHasProjectEdgeType::EDGECONST, + )); + $edge_query->execute(); + + foreach ($tasks as $task) { + $phids = $edge_query->getDestinationPHIDs(array($task->getPHID())); + $task->attachProjectPHIDs($phids); + } + + return $tasks; + } + private function buildTaskIDsWhereClause(AphrontDatabaseConnection $conn) { if (!$this->taskIDs) { return null; @@ -523,13 +544,13 @@ final class ManiphestTaskQuery extends PhabricatorCursorPagedPolicyAwareQuery { if ($this->projectPHIDs) { $parts[] = qsprintf( $conn, - 'project.projectPHID in (%Ls)', + 'project.dst in (%Ls)', $this->projectPHIDs); } if ($this->includeNoProject) { $parts[] = qsprintf( $conn, - 'project.projectPHID IS NULL'); + 'project.dst IS NULL'); } return '('.implode(') OR (', $parts).')'; @@ -542,7 +563,7 @@ final class ManiphestTaskQuery extends PhabricatorCursorPagedPolicyAwareQuery { return qsprintf( $conn, - 'anyproject.projectPHID IN (%Ls)', + 'anyproject.dst IN (%Ls)', $this->anyProjectPHIDs); } @@ -563,7 +584,7 @@ final class ManiphestTaskQuery extends PhabricatorCursorPagedPolicyAwareQuery { return qsprintf( $conn, - 'anyproject.projectPHID IN (%Ls)', + 'anyproject.dst IN (%Ls)', $any_user_project_phids); } @@ -574,7 +595,7 @@ final class ManiphestTaskQuery extends PhabricatorCursorPagedPolicyAwareQuery { return qsprintf( $conn, - 'xproject.projectPHID IS NULL'); + 'xproject.dst IS NULL'); } private function buildCustomOrderClause(AphrontDatabaseConnection $conn) { @@ -663,31 +684,37 @@ final class ManiphestTaskQuery extends PhabricatorCursorPagedPolicyAwareQuery { } private function buildJoinsClause(AphrontDatabaseConnection $conn_r) { - $project_dao = new ManiphestTaskProject(); + $edge_table = PhabricatorEdgeConfig::TABLE_NAME_EDGE; $joins = array(); if ($this->projectPHIDs || $this->includeNoProject) { $joins[] = qsprintf( $conn_r, - '%Q JOIN %T project ON project.taskPHID = task.phid', + '%Q JOIN %T project ON project.src = task.phid + AND project.type = %d', ($this->includeNoProject ? 'LEFT' : ''), - $project_dao->getTableName()); + $edge_table, + PhabricatorProjectObjectHasProjectEdgeType::EDGECONST); } if ($this->anyProjectPHIDs || $this->anyUserProjectPHIDs) { $joins[] = qsprintf( $conn_r, - 'JOIN %T anyproject ON anyproject.taskPHID = task.phid', - $project_dao->getTableName()); + 'JOIN %T anyproject ON anyproject.src = task.phid + AND anyproject.type = %d', + $edge_table, + PhabricatorProjectObjectHasProjectEdgeType::EDGECONST); } if ($this->xprojectPHIDs) { $joins[] = qsprintf( $conn_r, - 'LEFT JOIN %T xproject ON xproject.taskPHID = task.phid - AND xproject.projectPHID IN (%Ls)', - $project_dao->getTableName(), + 'LEFT JOIN %T xproject ON xproject.src = task.phid + AND xproject.type = %d + AND xproject.dst IN (%Ls)', + $edge_table, + PhabricatorProjectObjectHasProjectEdgeType::EDGECONST, $this->xprojectPHIDs); } @@ -705,20 +732,24 @@ final class ManiphestTaskQuery extends PhabricatorCursorPagedPolicyAwareQuery { if ($ignore_group_phids) { $joins[] = qsprintf( $conn_r, - 'LEFT JOIN %T projectGroup ON task.phid = projectGroup.taskPHID - AND projectGroup.projectPHID NOT IN (%Ls)', - $project_dao->getTableName(), + 'LEFT JOIN %T projectGroup ON task.phid = projectGroup.src + AND projectGroup.type = %d + AND projectGroup.dst NOT IN (%Ls)', + $edge_table, + PhabricatorProjectObjectHasProjectEdgeType::EDGECONST, $ignore_group_phids); } else { $joins[] = qsprintf( $conn_r, - 'LEFT JOIN %T projectGroup ON task.phid = projectGroup.taskPHID', - $project_dao->getTableName()); + 'LEFT JOIN %T projectGroup ON task.phid = projectGroup.src + AND projectGroup.type = %d', + $edge_table, + PhabricatorProjectObjectHasProjectEdgeType::EDGECONST); } $joins[] = qsprintf( $conn_r, 'LEFT JOIN %T projectGroupName - ON projectGroup.projectPHID = projectGroupName.indexedObjectPHID', + ON projectGroup.dst = projectGroupName.indexedObjectPHID', id(new ManiphestNameIndex())->getTableName()); break; } @@ -739,7 +770,7 @@ final class ManiphestTaskQuery extends PhabricatorCursorPagedPolicyAwareQuery { // task IDs. if ($joined_multiple_rows) { if ($joined_project_name) { - return 'GROUP BY task.phid, projectGroup.projectPHID'; + return 'GROUP BY task.phid, projectGroup.dst'; } else { return 'GROUP BY task.phid'; } diff --git a/src/applications/maniphest/query/ManiphestTaskSearchEngine.php b/src/applications/maniphest/query/ManiphestTaskSearchEngine.php index e3c8fe3bce..9709363a6a 100644 --- a/src/applications/maniphest/query/ManiphestTaskSearchEngine.php +++ b/src/applications/maniphest/query/ManiphestTaskSearchEngine.php @@ -339,7 +339,7 @@ final class ManiphestTaskSearchEngine $form ->appendChild( id(new AphrontFormTokenizerControl()) - ->setDatasource('/typeahead/common/accounts/') + ->setDatasource(new PhabricatorPeopleDatasource()) ->setName('assigned') ->setLabel(pht('Assigned To')) ->setValue($assigned_handles)) @@ -383,19 +383,19 @@ final class ManiphestTaskSearchEngine ->setValue($exclude_project_handles)) ->appendChild( id(new AphrontFormTokenizerControl()) - ->setDatasource('/typeahead/common/accounts/') + ->setDatasource(new PhabricatorPeopleDatasource()) ->setName('userProjects') ->setLabel(pht('In Users\' Projects')) ->setValue($user_project_handles)) ->appendChild( id(new AphrontFormTokenizerControl()) - ->setDatasource('/typeahead/common/accounts/') + ->setDatasource(new PhabricatorPeopleDatasource()) ->setName('authors') ->setLabel(pht('Authors')) ->setValue($author_handles)) ->appendChild( id(new AphrontFormTokenizerControl()) - ->setDatasource('/typeahead/common/mailable/') + ->setDatasource(new PhabricatorMetaMTAMailableDatasource()) ->setName('subscribers') ->setLabel(pht('Subscribers')) ->setValue($subscriber_handles)) diff --git a/src/applications/maniphest/storage/ManiphestTask.php b/src/applications/maniphest/storage/ManiphestTask.php index 9477f6af7c..3ee65438fa 100644 --- a/src/applications/maniphest/storage/ManiphestTask.php +++ b/src/applications/maniphest/storage/ManiphestTask.php @@ -8,7 +8,8 @@ final class ManiphestTask extends ManiphestDAO PhabricatorFlaggableInterface, PhrequentTrackableInterface, PhabricatorCustomFieldInterface, - PhabricatorDestructableInterface { + PhabricatorDestructibleInterface, + PhabricatorApplicationTransactionInterface { const MARKUP_FIELD_DESCRIPTION = 'markup:desc'; @@ -30,13 +31,13 @@ final class ManiphestTask extends ManiphestDAO protected $attached = array(); protected $projectPHIDs = array(); - private $projectsNeedUpdate; private $subscribersNeedUpdate; protected $ownerOrdering; private $groupByProjectPHID = self::ATTACHABLE; private $customFields = self::ATTACHABLE; + private $edgeProjectPHIDs = self::ATTACHABLE; public static function initializeNewTask(PhabricatorUser $actor) { $app = id(new PhabricatorApplicationQuery()) @@ -52,7 +53,8 @@ final class ManiphestTask extends ManiphestDAO ->setPriority(ManiphestTaskPriority::getDefaultPriority()) ->setAuthorPHID($actor->getPHID()) ->setViewPolicy($view_policy) - ->setEditPolicy($edit_policy); + ->setEditPolicy($edit_policy) + ->attachProjectPHIDs(array()); } public function getConfiguration() { @@ -90,14 +92,13 @@ final class ManiphestTask extends ManiphestDAO return array_values(nonempty($this->ccPHIDs, array())); } - public function setProjectPHIDs(array $phids) { - $this->projectPHIDs = array_values($phids); - $this->projectsNeedUpdate = true; - return $this; + public function getProjectPHIDs() { + return $this->assertAttached($this->edgeProjectPHIDs); } - public function getProjectPHIDs() { - return array_values(nonempty($this->projectPHIDs, array())); + public function attachProjectPHIDs(array $phids) { + $this->edgeProjectPHIDs = $phids; + return $this; } public function setCCPHIDs(array $phids) { @@ -140,13 +141,6 @@ final class ManiphestTask extends ManiphestDAO $result = parent::save(); - if ($this->projectsNeedUpdate) { - // If we've changed the project PHIDs for this task, update the link - // table. - ManiphestTaskProject::updateTaskProjects($this); - $this->projectsNeedUpdate = false; - } - if ($this->subscribersNeedUpdate) { // If we've changed the subscriber PHIDs for this task, update the link // table. @@ -291,7 +285,7 @@ final class ManiphestTask extends ManiphestDAO } -/* -( PhabricatorDestructableInterface )----------------------------------- */ +/* -( PhabricatorDestructibleInterface )----------------------------------- */ public function destroyObjectPermanently( @@ -312,4 +306,20 @@ final class ManiphestTask extends ManiphestDAO $this->saveTransaction(); } + +/* -( PhabricatorApplicationTransactionInterface )------------------------- */ + + + public function getApplicationTransactionEditor() { + return new ManiphestTransactionEditor(); + } + + public function getApplicationTransactionObject() { + return $this; + } + + public function getApplicationTransactionTemplate() { + return new ManiphestTransaction(); + } + } diff --git a/src/applications/maniphest/storage/ManiphestTaskProject.php b/src/applications/maniphest/storage/ManiphestTaskProject.php deleted file mode 100644 index f26627a01b..0000000000 --- a/src/applications/maniphest/storage/ManiphestTaskProject.php +++ /dev/null @@ -1,49 +0,0 @@ - Project table, which denormalizes the - * relationship between tasks and projects into a link table so it can be - * efficiently queried. This table is not authoritative; the projectPHIDs field - * of ManiphestTask is. The rows in this table are regenerated when transactions - * are applied to tasks which affected their associated projects. - */ -final class ManiphestTaskProject extends ManiphestDAO { - - protected $taskPHID; - protected $projectPHID; - - public function getConfiguration() { - return array( - self::CONFIG_IDS => self::IDS_MANUAL, - self::CONFIG_TIMESTAMPS => false, - ); - } - - public static function updateTaskProjects(ManiphestTask $task) { - $dao = new ManiphestTaskProject(); - $conn = $dao->establishConnection('w'); - - $sql = array(); - foreach ($task->getProjectPHIDs() as $project_phid) { - $sql[] = qsprintf( - $conn, - '(%s, %s)', - $task->getPHID(), - $project_phid); - } - - queryfx( - $conn, - 'DELETE FROM %T WHERE taskPHID = %s', - $dao->getTableName(), - $task->getPHID()); - if ($sql) { - queryfx( - $conn, - 'INSERT INTO %T (taskPHID, projectPHID) VALUES %Q', - $dao->getTableName(), - implode(', ', $sql)); - } - } - -} diff --git a/src/applications/maniphest/storage/ManiphestTransaction.php b/src/applications/maniphest/storage/ManiphestTransaction.php index 685d56f393..d3185d661c 100644 --- a/src/applications/maniphest/storage/ManiphestTransaction.php +++ b/src/applications/maniphest/storage/ManiphestTransaction.php @@ -788,8 +788,15 @@ final class ManiphestTransaction case self::TYPE_CCS: $tags[] = MetaMTANotificationType::TYPE_MANIPHEST_CC; break; - case self::TYPE_PROJECTS: - $tags[] = MetaMTANotificationType::TYPE_MANIPHEST_PROJECTS; + case PhabricatorTransactions::TYPE_EDGE: + switch ($this->getMetadataValue('edge:type')) { + case PhabricatorProjectObjectHasProjectEdgeType::EDGECONST: + $tags[] = MetaMTANotificationType::TYPE_MANIPHEST_PROJECTS; + break; + default: + $tags[] = MetaMTANotificationType::TYPE_MANIPHEST_OTHER; + break; + } break; case self::TYPE_PRIORITY: $tags[] = MetaMTANotificationType::TYPE_MANIPHEST_PRIORITY; diff --git a/src/applications/meta/phid/PhabricatorApplicationPHIDTypeApplication.php b/src/applications/meta/phid/PhabricatorApplicationPHIDTypeApplication.php index 6ce6c27c6c..d35e43e6e8 100644 --- a/src/applications/meta/phid/PhabricatorApplicationPHIDTypeApplication.php +++ b/src/applications/meta/phid/PhabricatorApplicationPHIDTypeApplication.php @@ -5,10 +5,6 @@ final class PhabricatorApplicationPHIDTypeApplication const TYPECONST = 'APPS'; - public function getTypeConstant() { - return self::TYPECONST; - } - public function getTypeName() { return pht('Application'); } diff --git a/src/applications/meta/typeahead/PhabricatorApplicationDatasource.php b/src/applications/meta/typeahead/PhabricatorApplicationDatasource.php new file mode 100644 index 0000000000..f092b2a81d --- /dev/null +++ b/src/applications/meta/typeahead/PhabricatorApplicationDatasource.php @@ -0,0 +1,43 @@ +getViewer(); + $raw_query = $this->getRawQuery(); + + $results = array(); + + $applications = PhabricatorApplication::getAllInstalledApplications(); + foreach ($applications as $application) { + $uri = $application->getTypeaheadURI(); + if (!$uri) { + continue; + } + $name = $application->getName().' '.$application->getShortDescription(); + $img = 'apps-'.$application->getIconName().'-dark-large'; + $results[] = id(new PhabricatorTypeaheadResult()) + ->setName($name) + ->setURI($uri) + ->setPHID($application->getPHID()) + ->setPriorityString($application->getName()) + ->setDisplayName($application->getName()) + ->setDisplayType($application->getShortDescription()) + ->setImageuRI($application->getIconURI()) + ->setPriorityType('apps') + ->setImageSprite('phabricator-search-icon sprite-apps-large '.$img); + } + + return $results; + } + +} diff --git a/src/applications/metamta/storage/PhabricatorMetaMTAMail.php b/src/applications/metamta/storage/PhabricatorMetaMTAMail.php index 53d5c1dd36..aa3dcc34ee 100644 --- a/src/applications/metamta/storage/PhabricatorMetaMTAMail.php +++ b/src/applications/metamta/storage/PhabricatorMetaMTAMail.php @@ -606,7 +606,7 @@ final class PhabricatorMetaMTAMail extends PhabricatorMetaMTADAO { } $add_to = array_unique($add_to); - $add_cc = array_unique($add_cc); + $add_cc = array_diff(array_unique($add_cc), $add_to); $mailer->addTos($add_to); if ($add_cc) { diff --git a/src/applications/metamta/typeahead/PhabricatorMetaMTAMailableDatasource.php b/src/applications/metamta/typeahead/PhabricatorMetaMTAMailableDatasource.php new file mode 100644 index 0000000000..0a6b5ea0b4 --- /dev/null +++ b/src/applications/metamta/typeahead/PhabricatorMetaMTAMailableDatasource.php @@ -0,0 +1,22 @@ +setPath('/'); id(new HTTPSFuture($server_uri, json_encode($data))) ->setMethod('POST') diff --git a/src/applications/nuance/phid/NuancePHIDTypeItem.php b/src/applications/nuance/phid/NuancePHIDTypeItem.php index 41008847fd..79238343c8 100644 --- a/src/applications/nuance/phid/NuancePHIDTypeItem.php +++ b/src/applications/nuance/phid/NuancePHIDTypeItem.php @@ -1,14 +1,9 @@ getRequest(); diff --git a/src/applications/oauthserver/controller/client/PhabricatorOAuthClientEditController.php b/src/applications/oauthserver/controller/client/PhabricatorOAuthClientEditController.php index 0de4776230..9ed97d85f5 100644 --- a/src/applications/oauthserver/controller/client/PhabricatorOAuthClientEditController.php +++ b/src/applications/oauthserver/controller/client/PhabricatorOAuthClientEditController.php @@ -1,7 +1,7 @@ getRequest(); diff --git a/src/applications/oauthserver/controller/client/PhabricatorOAuthClientListController.php b/src/applications/oauthserver/controller/client/PhabricatorOAuthClientListController.php index 230a1d47b0..ee5d85661a 100644 --- a/src/applications/oauthserver/controller/client/PhabricatorOAuthClientListController.php +++ b/src/applications/oauthserver/controller/client/PhabricatorOAuthClientListController.php @@ -1,7 +1,7 @@ getRequest(); diff --git a/src/applications/oauthserver/phid/PhabricatorOAuthServerPHIDTypeClient.php b/src/applications/oauthserver/phid/PhabricatorOAuthServerPHIDTypeClient.php index f66101a62f..a1776af81b 100644 --- a/src/applications/oauthserver/phid/PhabricatorOAuthServerPHIDTypeClient.php +++ b/src/applications/oauthserver/phid/PhabricatorOAuthServerPHIDTypeClient.php @@ -5,10 +5,6 @@ final class PhabricatorOAuthServerPHIDTypeClient const TYPECONST = 'OASC'; - public function getTypeConstant() { - return self::TYPECONST; - } - public function getTypeName() { return pht('OAuth Application'); } diff --git a/src/applications/oauthserver/phid/PhabricatorOAuthServerPHIDTypeClientAuthorization.php b/src/applications/oauthserver/phid/PhabricatorOAuthServerPHIDTypeClientAuthorization.php index 2784263667..9618ec1f8e 100644 --- a/src/applications/oauthserver/phid/PhabricatorOAuthServerPHIDTypeClientAuthorization.php +++ b/src/applications/oauthserver/phid/PhabricatorOAuthServerPHIDTypeClientAuthorization.php @@ -5,10 +5,6 @@ final class PhabricatorOAuthServerPHIDTypeClientAuthorization const TYPECONST = 'OASA'; - public function getTypeConstant() { - return self::TYPECONST; - } - public function getTypeName() { return pht('OAuth Authorization'); } diff --git a/src/applications/oauthserver/query/PhabricatorOAuthServerClientSearchEngine.php b/src/applications/oauthserver/query/PhabricatorOAuthServerClientSearchEngine.php index 25323f5129..ac777c3f59 100644 --- a/src/applications/oauthserver/query/PhabricatorOAuthServerClientSearchEngine.php +++ b/src/applications/oauthserver/query/PhabricatorOAuthServerClientSearchEngine.php @@ -45,7 +45,7 @@ final class PhabricatorOAuthServerClientSearchEngine $form ->appendChild( id(new AphrontFormTokenizerControl()) - ->setDatasource('/typeahead/common/users/') + ->setDatasource(new PhabricatorPeopleDatasource()) ->setName('creators') ->setLabel(pht('Creators')) ->setValue($creator_handles)); diff --git a/src/applications/owners/controller/PhabricatorOwnersEditController.php b/src/applications/owners/controller/PhabricatorOwnersEditController.php index f35a9f5edc..aface6a277 100644 --- a/src/applications/owners/controller/PhabricatorOwnersEditController.php +++ b/src/applications/owners/controller/PhabricatorOwnersEditController.php @@ -181,7 +181,7 @@ final class PhabricatorOwnersEditController ->setError($e_name)) ->appendChild( id(new AphrontFormTokenizerControl()) - ->setDatasource('/typeahead/common/usersorprojects/') + ->setDatasource(new PhabricatorProjectOrUserDatasource()) ->setLabel(pht('Primary Owner')) ->setName('primary') ->setLimit(1) @@ -189,7 +189,7 @@ final class PhabricatorOwnersEditController ->setError($e_primary)) ->appendChild( id(new AphrontFormTokenizerControl()) - ->setDatasource('/typeahead/common/usersorprojects/') + ->setDatasource(new PhabricatorProjectOrUserDatasource()) ->setLabel(pht('Owners')) ->setName('owners') ->setValue($handles_all_owners)) diff --git a/src/applications/owners/controller/PhabricatorOwnersListController.php b/src/applications/owners/controller/PhabricatorOwnersListController.php index a861a9e933..6f35bef0a5 100644 --- a/src/applications/owners/controller/PhabricatorOwnersListController.php +++ b/src/applications/owners/controller/PhabricatorOwnersListController.php @@ -177,7 +177,7 @@ final class PhabricatorOwnersListController ->setValue($request->getStr('name'))) ->appendChild( id(new AphrontFormTokenizerControl()) - ->setDatasource('/typeahead/common/usersorprojects/') + ->setDatasource(new PhabricatorProjectOrUserDatasource()) ->setLimit(1) ->setName('owner') ->setLabel(pht('Owner')) diff --git a/src/applications/owners/phid/PhabricatorOwnersPHIDTypePackage.php b/src/applications/owners/phid/PhabricatorOwnersPHIDTypePackage.php index b82b47a9ea..8c7a255114 100644 --- a/src/applications/owners/phid/PhabricatorOwnersPHIDTypePackage.php +++ b/src/applications/owners/phid/PhabricatorOwnersPHIDTypePackage.php @@ -4,14 +4,14 @@ final class PhabricatorOwnersPHIDTypePackage extends PhabricatorPHIDType { const TYPECONST = 'OPKG'; - public function getTypeConstant() { - return self::TYPECONST; - } - public function getTypeName() { return pht('Owners Package'); } + public function getTypeIcon() { + return 'fa-list-alt'; + } + public function newObject() { return new PhabricatorOwnersPackage(); } diff --git a/src/applications/owners/typeahead/PhabricatorOwnersPackageDatasource.php b/src/applications/owners/typeahead/PhabricatorOwnersPackageDatasource.php index edbcf758ce..7d681bc2cc 100644 --- a/src/applications/owners/typeahead/PhabricatorOwnersPackageDatasource.php +++ b/src/applications/owners/typeahead/PhabricatorOwnersPackageDatasource.php @@ -23,7 +23,6 @@ final class PhabricatorOwnersPackageDatasource foreach ($packages as $package) { $results[] = id(new PhabricatorTypeaheadResult()) - ->setIcon('fa-list-alt bluegrey') ->setName($package->getName()) ->setURI('/owners/package/'.$package->getID().'/') ->setPHID($package->getPHID()); diff --git a/src/applications/passphrase/phid/PassphrasePHIDTypeCredential.php b/src/applications/passphrase/phid/PassphrasePHIDTypeCredential.php index ac7fedaa93..cfd994f9bd 100644 --- a/src/applications/passphrase/phid/PassphrasePHIDTypeCredential.php +++ b/src/applications/passphrase/phid/PassphrasePHIDTypeCredential.php @@ -4,10 +4,6 @@ final class PassphrasePHIDTypeCredential extends PhabricatorPHIDType { const TYPECONST = 'CDTL'; - public function getTypeConstant() { - return self::TYPECONST; - } - public function getTypeName() { return pht('Credential'); } diff --git a/src/applications/paste/controller/PhabricatorPasteEditController.php b/src/applications/paste/controller/PhabricatorPasteEditController.php index a15f4a3af5..878b567a36 100644 --- a/src/applications/paste/controller/PhabricatorPasteEditController.php +++ b/src/applications/paste/controller/PhabricatorPasteEditController.php @@ -76,7 +76,7 @@ final class PhabricatorPasteEditController extends PhabricatorPasteController { } else { $v_projects = PhabricatorEdgeQuery::loadDestinationPHIDs( $paste->getPHID(), - PhabricatorEdgeConfig::TYPE_OBJECT_HAS_PROJECT); + PhabricatorProjectObjectHasProjectEdgeType::EDGECONST); $v_projects = array_reverse($v_projects); } @@ -121,7 +121,7 @@ final class PhabricatorPasteEditController extends PhabricatorPasteController { ->setTransactionType(PhabricatorTransactions::TYPE_VIEW_POLICY) ->setNewValue($v_policy); - $proj_edge_type = PhabricatorEdgeConfig::TYPE_OBJECT_HAS_PROJECT; + $proj_edge_type = PhabricatorProjectObjectHasProjectEdgeType::EDGECONST; $xactions[] = id(new PhabricatorPasteTransaction()) ->setTransactionType(PhabricatorTransactions::TYPE_EDGE) ->setMetadataValue('edge:type', $proj_edge_type) diff --git a/src/applications/paste/phid/PhabricatorPastePHIDTypePaste.php b/src/applications/paste/phid/PhabricatorPastePHIDTypePaste.php index 5e3ef4fd81..6256e2892c 100644 --- a/src/applications/paste/phid/PhabricatorPastePHIDTypePaste.php +++ b/src/applications/paste/phid/PhabricatorPastePHIDTypePaste.php @@ -4,10 +4,6 @@ final class PhabricatorPastePHIDTypePaste extends PhabricatorPHIDType { const TYPECONST = 'PSTE'; - public function getTypeConstant() { - return self::TYPECONST; - } - public function getTypeName() { return pht('Paste'); } diff --git a/src/applications/paste/query/PhabricatorPasteSearchEngine.php b/src/applications/paste/query/PhabricatorPasteSearchEngine.php index b589b25907..79cf87b9f6 100644 --- a/src/applications/paste/query/PhabricatorPasteSearchEngine.php +++ b/src/applications/paste/query/PhabricatorPasteSearchEngine.php @@ -67,7 +67,7 @@ final class PhabricatorPasteSearchEngine $form ->appendChild( id(new AphrontFormTokenizerControl()) - ->setDatasource('/typeahead/common/users/') + ->setDatasource(new PhabricatorPeopleDatasource()) ->setName('authors') ->setLabel(pht('Authors')) ->setValue($author_handles)) diff --git a/src/applications/people/phid/PhabricatorPeoplePHIDTypeExternal.php b/src/applications/people/phid/PhabricatorPeoplePHIDTypeExternal.php index f84d9f3a1a..96ac3f601d 100644 --- a/src/applications/people/phid/PhabricatorPeoplePHIDTypeExternal.php +++ b/src/applications/people/phid/PhabricatorPeoplePHIDTypeExternal.php @@ -4,10 +4,6 @@ final class PhabricatorPeoplePHIDTypeExternal extends PhabricatorPHIDType { const TYPECONST = 'XUSR'; - public function getTypeConstant() { - return self::TYPECONST; - } - public function getTypeName() { return pht('External Account'); } diff --git a/src/applications/people/phid/PhabricatorPeoplePHIDTypeUser.php b/src/applications/people/phid/PhabricatorPeoplePHIDTypeUser.php index 5f13d0e9a6..4be443a566 100644 --- a/src/applications/people/phid/PhabricatorPeoplePHIDTypeUser.php +++ b/src/applications/people/phid/PhabricatorPeoplePHIDTypeUser.php @@ -4,10 +4,6 @@ final class PhabricatorPeoplePHIDTypeUser extends PhabricatorPHIDType { const TYPECONST = 'USER'; - public function getTypeConstant() { - return self::TYPECONST; - } - public function getTypeName() { return pht('User'); } diff --git a/src/applications/people/query/PhabricatorPeopleLogSearchEngine.php b/src/applications/people/query/PhabricatorPeopleLogSearchEngine.php index 8af0e65838..772ae6005e 100644 --- a/src/applications/people/query/PhabricatorPeopleLogSearchEngine.php +++ b/src/applications/people/query/PhabricatorPeopleLogSearchEngine.php @@ -124,13 +124,13 @@ final class PhabricatorPeopleLogSearchEngine $form ->appendChild( id(new AphrontFormTokenizerControl()) - ->setDatasource('/typeahead/common/accounts/') + ->setDatasource(new PhabricatorPeopleDatasource()) ->setName('actors') ->setLabel(pht('Actors')) ->setValue($actor_handles)) ->appendChild( id(new AphrontFormTokenizerControl()) - ->setDatasource('/typeahead/common/accounts/') + ->setDatasource(new PhabricatorPeopleDatasource()) ->setName('users') ->setLabel(pht('Users')) ->setValue($user_handles)) diff --git a/src/applications/people/storage/PhabricatorUser.php b/src/applications/people/storage/PhabricatorUser.php index dedec7dc05..dbbedc97cf 100644 --- a/src/applications/people/storage/PhabricatorUser.php +++ b/src/applications/people/storage/PhabricatorUser.php @@ -9,7 +9,7 @@ final class PhabricatorUser PhutilPerson, PhabricatorPolicyInterface, PhabricatorCustomFieldInterface, - PhabricatorDestructableInterface { + PhabricatorDestructibleInterface { const SESSION_TABLE = 'phabricator_session'; const NAMETOKEN_TABLE = 'user_nametoken'; @@ -113,7 +113,6 @@ final class PhabricatorUser public function getConfiguration() { return array( self::CONFIG_AUX_PHID => true, - self::CONFIG_PARTIAL_OBJECTS => true, ) + parent::getConfiguration(); } @@ -532,32 +531,18 @@ final class PhabricatorUser return $this; } - private static function tokenizeName($name) { - if (function_exists('mb_strtolower')) { - $name = mb_strtolower($name, 'UTF-8'); - } else { - $name = strtolower($name); - } - $name = trim($name); - if (!strlen($name)) { - return array(); - } - return preg_split('/\s+/', $name); - } - /** * Populate the nametoken table, which used to fetch typeahead results. When * a user types "linc", we want to match "Abraham Lincoln" from on-demand * typeahead sources. To do this, we need a separate table of name fragments. */ public function updateNameTokens() { - $tokens = array_merge( - self::tokenizeName($this->getRealName()), - self::tokenizeName($this->getUserName())); - $tokens = array_unique($tokens); $table = self::NAMETOKEN_TABLE; $conn_w = $this->establishConnection('w'); + $tokens = PhabricatorTypeaheadDatasource::tokenizeString( + $this->getUserName().' '.$this->getRealName()); + $sql = array(); foreach ($tokens as $token) { $sql[] = qsprintf( @@ -908,7 +893,7 @@ EOBODY; } -/* -( PhabricatorDestructableInterface )----------------------------------- */ +/* -( PhabricatorDestructibleInterface )----------------------------------- */ public function destroyObjectPermanently( diff --git a/src/applications/people/typeahead/PhabricatorPeopleDatasource.php b/src/applications/people/typeahead/PhabricatorPeopleDatasource.php new file mode 100644 index 0000000000..d0f9aa2d18 --- /dev/null +++ b/src/applications/people/typeahead/PhabricatorPeopleDatasource.php @@ -0,0 +1,125 @@ +enrichResults = $enrich; + return $this; + } + + public function getPlaceholderText() { + return pht('Type a username...'); + } + + public function getDatasourceApplicationClass() { + return 'PhabricatorApplicationPeople'; + } + + public function loadResults() { + $viewer = $this->getViewer(); + $raw_query = $this->getRawQuery(); + + $results = array(); + + $users = array(); + if (strlen($raw_query)) { + // This is an arbitrary limit which is just larger than any limit we + // actually use in the application. + + // TODO: The datasource should pass this in the query. + $limit = 15; + + $user_table = new PhabricatorUser(); + $conn_r = $user_table->establishConnection('r'); + $ids = queryfx_all( + $conn_r, + 'SELECT id FROM %T WHERE username LIKE %> + ORDER BY username ASC LIMIT %d', + $user_table->getTableName(), + $raw_query, + $limit); + $ids = ipull($ids, 'id'); + + if (count($ids) < $limit) { + // If we didn't find enough username hits, look for real name hits. + // We need to pull the entire pagesize so that we end up with the + // right number of items if this query returns many duplicate IDs + // that we've already selected. + + $realname_ids = queryfx_all( + $conn_r, + 'SELECT DISTINCT userID FROM %T WHERE token LIKE %> + ORDER BY token ASC LIMIT %d', + PhabricatorUser::NAMETOKEN_TABLE, + $raw_query, + $limit); + $realname_ids = ipull($realname_ids, 'userID'); + $ids = array_merge($ids, $realname_ids); + + $ids = array_unique($ids); + $ids = array_slice($ids, 0, $limit); + } + + // Always add the logged-in user because some tokenizers autosort them + // first. They'll be filtered out on the client side if they don't + // match the query. + if ($viewer->getID()) { + $ids[] = $viewer->getID(); + } + + if ($ids) { + $users = id(new PhabricatorPeopleQuery()) + ->setViewer($viewer) + ->withIDs($ids) + ->execute(); + } + } + + if ($this->enrichResults && $users) { + $phids = mpull($users, 'getPHID'); + $handles = id(new PhabricatorHandleQuery()) + ->setViewer($viewer) + ->withPHIDs($phids) + ->execute(); + } + + foreach ($users as $user) { + $closed = null; + if ($user->getIsDisabled()) { + $closed = pht('Disabled'); + } else if ($user->getIsSystemAgent()) { + $closed = pht('Bot/Script'); + } + + $result = id(new PhabricatorTypeaheadResult()) + ->setName($user->getFullName()) + ->setURI('/p/'.$user->getUsername()) + ->setPHID($user->getPHID()) + ->setPriorityString($user->getUsername()) + ->setPriorityType('user') + ->setClosed($closed); + + if ($this->enrichResults) { + $display_type = 'User'; + if ($user->getIsAdmin()) { + $display_type = 'Administrator'; + } + $result->setDisplayType($display_type); + $result->setImageURI($handles[$user->getPHID()]->getImageURI()); + } + + $results[] = $result; + } + + return $results; + } + +} diff --git a/src/applications/phame/phid/PhabricatorPhamePHIDTypeBlog.php b/src/applications/phame/phid/PhabricatorPhamePHIDTypeBlog.php index 633182dd14..bc38181e5b 100644 --- a/src/applications/phame/phid/PhabricatorPhamePHIDTypeBlog.php +++ b/src/applications/phame/phid/PhabricatorPhamePHIDTypeBlog.php @@ -4,10 +4,6 @@ final class PhabricatorPhamePHIDTypeBlog extends PhabricatorPHIDType { const TYPECONST = 'BLOG'; - public function getTypeConstant() { - return self::TYPECONST; - } - public function getTypeName() { return pht('Phame Blog'); } diff --git a/src/applications/phame/phid/PhabricatorPhamePHIDTypePost.php b/src/applications/phame/phid/PhabricatorPhamePHIDTypePost.php index 240851a9c3..09080708d6 100644 --- a/src/applications/phame/phid/PhabricatorPhamePHIDTypePost.php +++ b/src/applications/phame/phid/PhabricatorPhamePHIDTypePost.php @@ -4,10 +4,6 @@ final class PhabricatorPhamePHIDTypePost extends PhabricatorPHIDType { const TYPECONST = 'POST'; - public function getTypeConstant() { - return self::TYPECONST; - } - public function getTypeName() { return pht('Phame Post'); } diff --git a/src/applications/phid/type/PhabricatorPHIDType.php b/src/applications/phid/type/PhabricatorPHIDType.php index e1d1647eb2..221048f93b 100644 --- a/src/applications/phid/type/PhabricatorPHIDType.php +++ b/src/applications/phid/type/PhabricatorPHIDType.php @@ -2,7 +2,28 @@ abstract class PhabricatorPHIDType { - abstract public function getTypeConstant(); + final public function getTypeConstant() { + $class = new ReflectionClass($this); + + $const = $class->getConstant('TYPECONST'); + if ($const === false) { + throw new Exception( + pht( + 'PHIDType class "%s" must define an TYPECONST property.', + get_class($this))); + } + + if (!is_string($const) || !preg_match('/^[A-Z]{4}$/', $const)) { + throw new Exception( + pht( + 'PHIDType class "%s" has an invalid TYPECONST property. PHID '. + 'constants must be a four character uppercase string.', + get_class($this))); + } + + return $const; + } + abstract public function getTypeName(); public function newObject() { @@ -114,7 +135,7 @@ abstract class PhabricatorPHIDType { public function loadNamedObjects( PhabricatorObjectQuery $query, array $names) { - throw new Exception('Not implemented!'); + throw new PhutilMethodNotImplementedException(); } diff --git a/src/applications/phlux/phid/PhluxPHIDTypeVariable.php b/src/applications/phlux/phid/PhluxPHIDTypeVariable.php index 165bc6d6e7..dc61151b86 100644 --- a/src/applications/phlux/phid/PhluxPHIDTypeVariable.php +++ b/src/applications/phlux/phid/PhluxPHIDTypeVariable.php @@ -4,10 +4,6 @@ final class PhluxPHIDTypeVariable extends PhabricatorPHIDType { const TYPECONST = 'PVAR'; - public function getTypeConstant() { - return self::TYPECONST; - } - public function getTypeName() { return pht('Variable'); } diff --git a/src/applications/pholio/controller/PholioMockEditController.php b/src/applications/pholio/controller/PholioMockEditController.php index 669c0fc1a8..7fed740bfc 100644 --- a/src/applications/pholio/controller/PholioMockEditController.php +++ b/src/applications/pholio/controller/PholioMockEditController.php @@ -49,7 +49,7 @@ final class PholioMockEditController extends PholioController { } else { $v_projects = PhabricatorEdgeQuery::loadDestinationPHIDs( $mock->getPHID(), - PhabricatorEdgeConfig::TYPE_OBJECT_HAS_PROJECT); + PhabricatorProjectObjectHasProjectEdgeType::EDGECONST); $v_projects = array_reverse($v_projects); } @@ -205,7 +205,7 @@ final class PholioMockEditController extends PholioController { } if (!$errors) { - $proj_edge_type = PhabricatorEdgeConfig::TYPE_OBJECT_HAS_PROJECT; + $proj_edge_type = PhabricatorProjectObjectHasProjectEdgeType::EDGECONST; $xactions[] = id(new PholioTransaction()) ->setTransactionType(PhabricatorTransactions::TYPE_EDGE) ->setMetadataValue('edge:type', $proj_edge_type) @@ -354,7 +354,7 @@ final class PholioMockEditController extends PholioController { ->setName('cc') ->setValue($handles) ->setUser($user) - ->setDatasource('/typeahead/common/mailable/')) + ->setDatasource(new PhabricatorMetaMTAMailableDatasource())) ->appendChild( id(new AphrontFormPolicyControl()) ->setUser($user) diff --git a/src/applications/pholio/phid/PholioPHIDTypeImage.php b/src/applications/pholio/phid/PholioPHIDTypeImage.php index 54b806cc21..0df43956fc 100644 --- a/src/applications/pholio/phid/PholioPHIDTypeImage.php +++ b/src/applications/pholio/phid/PholioPHIDTypeImage.php @@ -4,10 +4,6 @@ final class PholioPHIDTypeImage extends PhabricatorPHIDType { const TYPECONST = 'PIMG'; - public function getTypeConstant() { - return self::TYPECONST; - } - public function getTypeName() { return pht('Image'); } diff --git a/src/applications/pholio/phid/PholioPHIDTypeMock.php b/src/applications/pholio/phid/PholioPHIDTypeMock.php index 39025fcfd8..0cd08c8e68 100644 --- a/src/applications/pholio/phid/PholioPHIDTypeMock.php +++ b/src/applications/pholio/phid/PholioPHIDTypeMock.php @@ -4,10 +4,6 @@ final class PholioPHIDTypeMock extends PhabricatorPHIDType { const TYPECONST = 'MOCK'; - public function getTypeConstant() { - return self::TYPECONST; - } - public function getTypeName() { return pht('Mock'); } diff --git a/src/applications/pholio/query/PholioMockSearchEngine.php b/src/applications/pholio/query/PholioMockSearchEngine.php index 231d020ca5..3b214e7d63 100644 --- a/src/applications/pholio/query/PholioMockSearchEngine.php +++ b/src/applications/pholio/query/PholioMockSearchEngine.php @@ -55,7 +55,7 @@ final class PholioMockSearchEngine $form ->appendChild( id(new AphrontFormTokenizerControl()) - ->setDatasource('/typeahead/common/users/') + ->setDatasource(new PhabricatorPeopleDatasource()) ->setName('authors') ->setLabel(pht('Authors')) ->setValue($author_handles)) diff --git a/src/applications/pholio/storage/PholioMock.php b/src/applications/pholio/storage/PholioMock.php index d08859286b..c4c1e58f67 100644 --- a/src/applications/pholio/storage/PholioMock.php +++ b/src/applications/pholio/storage/PholioMock.php @@ -9,7 +9,7 @@ final class PholioMock extends PholioDAO PhabricatorFlaggableInterface, PhabricatorApplicationTransactionInterface, PhabricatorProjectInterface, - PhabricatorDestructableInterface { + PhabricatorDestructibleInterface { const MARKUP_FIELD_DESCRIPTION = 'markup:description'; @@ -258,7 +258,7 @@ final class PholioMock extends PholioDAO } -/* -( PhabricatorDestructableInterface )----------------------------------- */ +/* -( PhabricatorDestructibleInterface )----------------------------------- */ public function destroyObjectPermanently( diff --git a/src/applications/phragment/phid/PhragmentPHIDTypeFragment.php b/src/applications/phragment/phid/PhragmentPHIDTypeFragment.php index 0a5484911e..2b26e6717c 100644 --- a/src/applications/phragment/phid/PhragmentPHIDTypeFragment.php +++ b/src/applications/phragment/phid/PhragmentPHIDTypeFragment.php @@ -1,14 +1,9 @@ setViewer($user) ->needPreemptingEvents(true) + ->withEnded(PhrequentUserTimeQuery::ENDED_NO) ->withUserPHIDs(array($user->getPHID())) ->execute(); diff --git a/src/applications/phrequent/query/PhrequentSearchEngine.php b/src/applications/phrequent/query/PhrequentSearchEngine.php index 1a90463bd2..6c3a4e1566 100644 --- a/src/applications/phrequent/query/PhrequentSearchEngine.php +++ b/src/applications/phrequent/query/PhrequentSearchEngine.php @@ -69,7 +69,7 @@ final class PhrequentSearchEngine $form ->appendChild( id(new AphrontFormTokenizerControl()) - ->setDatasource('/typeahead/common/users/') + ->setDatasource(new PhabricatorPeopleDatasource()) ->setName('users') ->setLabel(pht('Users')) ->setValue($handles)) diff --git a/src/applications/phrequent/query/PhrequentUserTimeQuery.php b/src/applications/phrequent/query/PhrequentUserTimeQuery.php index 190be7652b..9fc382674b 100644 --- a/src/applications/phrequent/query/PhrequentUserTimeQuery.php +++ b/src/applications/phrequent/query/PhrequentUserTimeQuery.php @@ -199,7 +199,7 @@ final class PhrequentUserTimeQuery $u_start = $u_event->getDateStarted(); $u_end = $u_event->getDateEnded(); - if (($u_start >= $e_start) && ($u_end <= $e_end) && + if (($u_start >= $e_start) && ($u_end === null || $u_end > $e_start)) { $select[] = $u_event; } diff --git a/src/applications/phrequent/storage/PhrequentTimeBlock.php b/src/applications/phrequent/storage/PhrequentTimeBlock.php index a625e2d2f9..ee5fd00a44 100644 --- a/src/applications/phrequent/storage/PhrequentTimeBlock.php +++ b/src/applications/phrequent/storage/PhrequentTimeBlock.php @@ -10,17 +10,16 @@ final class PhrequentTimeBlock extends Phobject { } public function getTimeSpentOnObject($phid, $now) { - $ranges = idx($this->getObjectTimeRanges($now), $phid, array()); + $slices = idx($this->getObjectTimeRanges(), $phid); - $sum = 0; - foreach ($ranges as $range) { - $sum += ($range[1] - $range[0]); + if (!$slices) { + return null; } - return $sum; + return $slices->getDuration($now); } - public function getObjectTimeRanges($now) { + public function getObjectTimeRanges() { $ranges = array(); $range_start = time(); @@ -29,6 +28,7 @@ final class PhrequentTimeBlock extends Phobject { } $object_ranges = array(); + $object_ongoing = array(); foreach ($this->events as $event) { // First, convert each event's preempting stack into a linear timeline @@ -42,14 +42,16 @@ final class PhrequentTimeBlock extends Phobject { ); $timeline[] = array( 'event' => $event, - 'at' => (int)nonempty($event->getDateEnded(), $now), + 'at' => (int)nonempty($event->getDateEnded(), PHP_INT_MAX), 'type' => 'end', ); $base_phid = $event->getObjectPHID(); + if (!$event->getDateEnded()) { + $object_ongoing[$base_phid] = true; + } $preempts = $event->getPreemptingEvents(); - foreach ($preempts as $preempt) { $same_object = ($preempt->getObjectPHID() == $base_phid); $timeline[] = array( @@ -59,7 +61,7 @@ final class PhrequentTimeBlock extends Phobject { ); $timeline[] = array( 'event' => $preempt, - 'at' => (int)nonempty($preempt->getDateEnded(), $now), + 'at' => (int)nonempty($preempt->getDateEnded(), PHP_INT_MAX), 'type' => $same_object ? 'end' : 'pop', ); } @@ -89,7 +91,6 @@ final class PhrequentTimeBlock extends Phobject { $stratum = null; $strata = array(); - $ranges = array(); foreach ($timeline as $timeline_event) { $id = $timeline_event['event']->getID(); @@ -173,15 +174,39 @@ final class PhrequentTimeBlock extends Phobject { } } + // Filter out ranges with an indefinite start time. These occur when + // popping the stack when there are multiple ongoing events. + foreach ($ranges as $key => $range) { + if ($range[0] == PHP_INT_MAX) { + unset($ranges[$key]); + } + } + $object_ranges[$base_phid][] = $ranges; } - // Finally, collapse all the ranges so we don't double-count time. - + // Collapse all the ranges so we don't double-count time. foreach ($object_ranges as $phid => $ranges) { $object_ranges[$phid] = self::mergeTimeRanges(array_mergev($ranges)); } + foreach ($object_ranges as $phid => $ranges) { + foreach ($ranges as $key => $range) { + if ($range[1] == PHP_INT_MAX) { + $ranges[$key][1] = null; + } + } + + $object_ranges[$phid] = new PhrequentTimeSlices( + $phid, + isset($object_ongoing[$phid]), + $ranges); + } + + // Reorder the ranges to be more stack-like, so the first item is the + // top of the stack. + $object_ranges = array_reverse($object_ranges, $preserve_keys = true); + return $object_ranges; } @@ -189,33 +214,22 @@ final class PhrequentTimeBlock extends Phobject { * Returns the current list of work. */ public function getCurrentWorkStack($now, $include_inactive = false) { - $ranges = $this->getObjectTimeRanges($now); + $ranges = $this->getObjectTimeRanges(); $results = array(); - foreach ($ranges as $phid => $blocks) { - $total = 0; - foreach ($blocks as $block) { - $total += $block[1] - $block[0]; - } - - $type = 'inactive'; - foreach ($blocks as $block) { - if ($block[1] === $now) { - if ($block[0] === $block[1]) { - $type = 'suspended'; - } else { - $type = 'active'; - } - break; + $active = null; + foreach ($ranges as $phid => $slices) { + if (!$include_inactive) { + if (!$slices->getIsOngoing()) { + continue; } } - if ($include_inactive || $type !== 'inactive') { - $results[] = array( - 'phid' => $phid, - 'time' => $total, - 'type' => $type); - } + $results[] = array( + 'phid' => $phid, + 'time' => $slices->getDuration($now), + 'ongoing' => $slices->getIsOngoing(), + ); } return $results; diff --git a/src/applications/phrequent/storage/PhrequentTimeSlices.php b/src/applications/phrequent/storage/PhrequentTimeSlices.php new file mode 100644 index 0000000000..30c4345720 --- /dev/null +++ b/src/applications/phrequent/storage/PhrequentTimeSlices.php @@ -0,0 +1,37 @@ +objectPHID = $object_phid; + $this->isOngoing = $is_ongoing; + $this->ranges = $ranges; + } + + public function getObjectPHID() { + return $this->objectPHID; + } + + public function getDuration($now) { + foreach ($this->ranges as $range) { + if ($range[1] === null) { + return $now - $range[0]; + } else { + return $range[1] - $range[0]; + } + } + } + + public function getIsOngoing() { + return $this->isOngoing; + } + + public function getRanges() { + return $this->ranges; + } + +} diff --git a/src/applications/phrequent/storage/__tests__/PhrequentTimeBlockTestCase.php b/src/applications/phrequent/storage/__tests__/PhrequentTimeBlockTestCase.php index 6bb09b5497..d42560090e 100644 --- a/src/applications/phrequent/storage/__tests__/PhrequentTimeBlockTestCase.php +++ b/src/applications/phrequent/storage/__tests__/PhrequentTimeBlockTestCase.php @@ -86,7 +86,9 @@ final class PhrequentTimeBlockTestCase extends PhabricatorTestCase { $block = new PhrequentTimeBlock(array($event)); - $ranges = $block->getObjectTimeRanges(1800); + $ranges = $block->getObjectTimeRanges(); + $ranges = $this->reduceRanges($ranges); + $this->assertEqual( array( 'T1' => array( @@ -107,7 +109,9 @@ final class PhrequentTimeBlockTestCase extends PhabricatorTestCase { $block = new PhrequentTimeBlock(array($event)); - $ranges = $block->getObjectTimeRanges(1000); + $ranges = $block->getObjectTimeRanges(); + $ranges = $this->reduceRanges($ranges); + $this->assertEqual( array( 'T2' => array( @@ -150,7 +154,9 @@ final class PhrequentTimeBlockTestCase extends PhabricatorTestCase { $block = new PhrequentTimeBlock(array($event)); - $ranges = $block->getObjectTimeRanges(1800); + $ranges = $block->getObjectTimeRanges(); + $ranges = $this->reduceRanges($ranges); + $this->assertEqual( array( 'T1' => array( @@ -172,7 +178,8 @@ final class PhrequentTimeBlockTestCase extends PhabricatorTestCase { $block = new PhrequentTimeBlock(array($event)); - $ranges = $block->getObjectTimeRanges(1000); + $ranges = $block->getObjectTimeRanges(); + $ranges = $this->reduceRanges($ranges); $this->assertEqual( array( @@ -198,7 +205,8 @@ final class PhrequentTimeBlockTestCase extends PhabricatorTestCase { $block = new PhrequentTimeBlock(array($event)); - $ranges = $block->getObjectTimeRanges(1000); + $ranges = $block->getObjectTimeRanges(); + $ranges = $this->reduceRanges($ranges); $this->assertEqual( array( @@ -213,6 +221,67 @@ final class PhrequentTimeBlockTestCase extends PhabricatorTestCase { $ranges); } + public function testOngoing() { + $event = $this->newEvent('T1', 1, null); + $event->attachPreemptingEvents(array()); + + $block = new PhrequentTimeBlock(array($event)); + + $ranges = $block->getObjectTimeRanges(); + $ranges = $this->reduceRanges($ranges); + + $this->assertEqual( + array( + 'T1' => array( + array(1, null), + ), + ), + $ranges); + } + + public function testOngoingInterrupted() { + $event = $this->newEvent('T1', 1, null); + $event->attachPreemptingEvents( + array( + $this->newEvent('T2', 100, 900), + )); + + $block = new PhrequentTimeBlock(array($event)); + + $ranges = $block->getObjectTimeRanges(); + $ranges = $this->reduceRanges($ranges); + + $this->assertEqual( + array( + 'T1' => array( + array(1, 100), + array(900, null) + ), + ), + $ranges); + } + + public function testOngoingPreempted() { + $event = $this->newEvent('T1', 1, null); + $event->attachPreemptingEvents( + array( + $this->newEvent('T2', 100, null), + )); + + $block = new PhrequentTimeBlock(array($event)); + + $ranges = $block->getObjectTimeRanges(); + $ranges = $this->reduceRanges($ranges); + + $this->assertEqual( + array( + 'T1' => array( + array(1, 100), + ), + ), + $ranges); + } + private function newEvent($object_phid, $start_time, $end_time) { static $id = 0; @@ -223,4 +292,14 @@ final class PhrequentTimeBlockTestCase extends PhabricatorTestCase { ->setDateEnded($end_time); } + private function reduceRanges(array $ranges) { + $results = array(); + + foreach ($ranges as $phid => $slices) { + $results[$phid] = $slices->getRanges(); + } + + return $results; + } + } diff --git a/src/applications/phriction/phid/PhrictionPHIDTypeDocument.php b/src/applications/phriction/phid/PhrictionPHIDTypeDocument.php index 01034362c6..f043db7b18 100644 --- a/src/applications/phriction/phid/PhrictionPHIDTypeDocument.php +++ b/src/applications/phriction/phid/PhrictionPHIDTypeDocument.php @@ -4,10 +4,6 @@ final class PhrictionPHIDTypeDocument extends PhabricatorPHIDType { const TYPECONST = 'WIKI'; - public function getTypeConstant() { - return self::TYPECONST; - } - public function getTypeName() { return pht('Wiki Document'); } diff --git a/src/applications/phriction/remarkup/PhrictionRemarkupRule.php b/src/applications/phriction/remarkup/PhrictionRemarkupRule.php index b8f61b2c02..48eb9cc3ee 100644 --- a/src/applications/phriction/remarkup/PhrictionRemarkupRule.php +++ b/src/applications/phriction/remarkup/PhrictionRemarkupRule.php @@ -3,7 +3,7 @@ final class PhrictionRemarkupRule extends PhutilRemarkupRule { public function getPriority() { - return 350.0; + return 175.0; } public function apply($text) { diff --git a/src/applications/phriction/storage/PhrictionDocument.php b/src/applications/phriction/storage/PhrictionDocument.php index 8c5b5d58bc..9ba8fbccf1 100644 --- a/src/applications/phriction/storage/PhrictionDocument.php +++ b/src/applications/phriction/storage/PhrictionDocument.php @@ -5,7 +5,8 @@ final class PhrictionDocument extends PhrictionDAO PhabricatorPolicyInterface, PhabricatorSubscribableInterface, PhabricatorFlaggableInterface, - PhabricatorTokenReceiverInterface { + PhabricatorTokenReceiverInterface, + PhabricatorDestructibleInterface { protected $slug; protected $depth; @@ -180,4 +181,26 @@ final class PhrictionDocument extends PhrictionDAO public function getUsersToNotifyOfTokenGiven() { return PhabricatorSubscribersQuery::loadSubscribersForPHID($this->phid); } + + +/* -( PhabricatorDestructibleInterface )----------------------------------- */ + + + public function destroyObjectPermanently( + PhabricatorDestructionEngine $engine) { + + $this->openTransaction(); + + $this->delete(); + + $contents = id(new PhrictionContent())->loadAllWhere( + 'documentID = %d', + $this->getID()); + foreach ($contents as $content) { + $content->delete(); + } + + $this->saveTransaction(); + } + } diff --git a/src/applications/policy/phid/PhabricatorPolicyPHIDTypePolicy.php b/src/applications/policy/phid/PhabricatorPolicyPHIDTypePolicy.php index 784ad8926a..225aa22ac1 100644 --- a/src/applications/policy/phid/PhabricatorPolicyPHIDTypePolicy.php +++ b/src/applications/policy/phid/PhabricatorPolicyPHIDTypePolicy.php @@ -1,14 +1,9 @@ new AphrontTokenizerTemplateView(), - 'uri' => '/typeahead/common/accounts/', - 'placeholder' => pht('Type a user name...'), + 'uri' => $users_datasource->getDatasourceURI(), + 'placeholder' => $users_datasource->getPlaceholderText(), ); } diff --git a/src/applications/ponder/controller/PonderQuestionEditController.php b/src/applications/ponder/controller/PonderQuestionEditController.php index 55bfb75d5b..557c2c8910 100644 --- a/src/applications/ponder/controller/PonderQuestionEditController.php +++ b/src/applications/ponder/controller/PonderQuestionEditController.php @@ -27,7 +27,7 @@ final class PonderQuestionEditController extends PonderController { } $v_projects = PhabricatorEdgeQuery::loadDestinationPHIDs( $question->getPHID(), - PhabricatorEdgeConfig::TYPE_OBJECT_HAS_PROJECT); + PhabricatorProjectObjectHasProjectEdgeType::EDGECONST); $v_projects = array_reverse($v_projects); } else { $question = id(new PonderQuestion()) @@ -70,7 +70,7 @@ final class PonderQuestionEditController extends PonderController { ->setTransactionType(PonderQuestionTransaction::TYPE_CONTENT) ->setNewValue($v_content); - $proj_edge_type = PhabricatorEdgeConfig::TYPE_OBJECT_HAS_PROJECT; + $proj_edge_type = PhabricatorProjectObjectHasProjectEdgeType::EDGECONST; $xactions[] = id(new PonderQuestionTransaction()) ->setTransactionType(PhabricatorTransactions::TYPE_EDGE) ->setMetadataValue('edge:type', $proj_edge_type) diff --git a/src/applications/ponder/editor/PonderVoteEditor.php b/src/applications/ponder/editor/PonderVoteEditor.php index c1448d2b7a..cc9f89d9fe 100644 --- a/src/applications/ponder/editor/PonderVoteEditor.php +++ b/src/applications/ponder/editor/PonderVoteEditor.php @@ -34,7 +34,6 @@ final class PonderVoteEditor extends PhabricatorEditor { // prepare vote add, or update if this user is amending an // earlier vote $editor = id(new PhabricatorEdgeEditor()) - ->setActor($actor) ->addEdge( $actor->getPHID(), $votable->getUserVoteEdgeType(), diff --git a/src/applications/ponder/phid/PonderPHIDTypeAnswer.php b/src/applications/ponder/phid/PonderPHIDTypeAnswer.php index be6b4d6779..c4a6a7477c 100644 --- a/src/applications/ponder/phid/PonderPHIDTypeAnswer.php +++ b/src/applications/ponder/phid/PonderPHIDTypeAnswer.php @@ -4,10 +4,6 @@ final class PonderPHIDTypeAnswer extends PhabricatorPHIDType { const TYPECONST = 'ANSW'; - public function getTypeConstant() { - return self::TYPECONST; - } - public function getTypeName() { return pht('Answer'); } diff --git a/src/applications/ponder/phid/PonderPHIDTypeQuestion.php b/src/applications/ponder/phid/PonderPHIDTypeQuestion.php index 10000df7e0..d057241a95 100644 --- a/src/applications/ponder/phid/PonderPHIDTypeQuestion.php +++ b/src/applications/ponder/phid/PonderPHIDTypeQuestion.php @@ -4,10 +4,6 @@ final class PonderPHIDTypeQuestion extends PhabricatorPHIDType { const TYPECONST = 'QUES'; - public function getTypeConstant() { - return self::TYPECONST; - } - public function getTypeName() { return pht('Question'); } diff --git a/src/applications/ponder/query/PonderQuestionSearchEngine.php b/src/applications/ponder/query/PonderQuestionSearchEngine.php index 9592341530..8be8ec1b9c 100644 --- a/src/applications/ponder/query/PonderQuestionSearchEngine.php +++ b/src/applications/ponder/query/PonderQuestionSearchEngine.php @@ -73,13 +73,13 @@ final class PonderQuestionSearchEngine $form ->appendChild( id(new AphrontFormTokenizerControl()) - ->setDatasource('/typeahead/common/users/') + ->setDatasource(new PhabricatorPeopleDatasource()) ->setName('authors') ->setLabel(pht('Authors')) ->setValue(array_select_keys($handles, $author_phids))) ->appendChild( id(new AphrontFormTokenizerControl()) - ->setDatasource('/typeahead/common/users/') + ->setDatasource(new PhabricatorPeopleDatasource()) ->setName('answerers') ->setLabel(pht('Answered By')) ->setValue(array_select_keys($handles, $answerer_phids))) diff --git a/src/applications/project/controller/PhabricatorProjectMembersEditController.php b/src/applications/project/controller/PhabricatorProjectMembersEditController.php index 24663967bd..7fc8bb4019 100644 --- a/src/applications/project/controller/PhabricatorProjectMembersEditController.php +++ b/src/applications/project/controller/PhabricatorProjectMembersEditController.php @@ -83,7 +83,7 @@ final class PhabricatorProjectMembersEditController id(new AphrontFormTokenizerControl()) ->setName('phids') ->setLabel(pht('Add Members')) - ->setDatasource('/typeahead/common/accounts/')) + ->setDatasource(new PhabricatorPeopleDatasource())) ->appendChild( id(new AphrontFormSubmitControl()) ->addCancelButton('/project/view/'.$project->getID().'/') diff --git a/src/applications/project/edge/PhabricatorProjectObjectHasProjectEdgeType.php b/src/applications/project/edge/PhabricatorProjectObjectHasProjectEdgeType.php new file mode 100644 index 0000000000..789a3cbba5 --- /dev/null +++ b/src/applications/project/edge/PhabricatorProjectObjectHasProjectEdgeType.php @@ -0,0 +1,102 @@ +setProjectPHID($object->getPHID()) ->save(); + $object->updateDatasourceTokens(); + // TODO -- delete all of the below once we sever automagical project // to phriction stuff if ($xaction->getOldValue() === null) { @@ -182,6 +184,9 @@ final class PhabricatorProjectTransactionEditor $rem_slug->delete(); } } + + $object->updateDatasourceTokens(); + return; case PhabricatorTransactions::TYPE_VIEW_POLICY: case PhabricatorTransactions::TYPE_EDIT_POLICY: @@ -231,8 +236,7 @@ final class PhabricatorProjectTransactionEditor if ($rem) { // When removing members, also remove any watches on the project. - $edge_editor = id(new PhabricatorEdgeEditor()) - ->setSuppressEvents(true); + $edge_editor = new PhabricatorEdgeEditor(); foreach ($rem as $rem_phid) { $edge_editor->removeEdge( $object->getPHID(), diff --git a/src/applications/project/events/PhabricatorProjectUIEventListener.php b/src/applications/project/events/PhabricatorProjectUIEventListener.php index 58d48c8409..1462fe456d 100644 --- a/src/applications/project/events/PhabricatorProjectUIEventListener.php +++ b/src/applications/project/events/PhabricatorProjectUIEventListener.php @@ -31,7 +31,7 @@ final class PhabricatorProjectUIEventListener $project_phids = PhabricatorEdgeQuery::loadDestinationPHIDs( $object->getPHID(), - PhabricatorEdgeConfig::TYPE_OBJECT_HAS_PROJECT); + PhabricatorProjectObjectHasProjectEdgeType::EDGECONST); if ($project_phids) { $project_phids = array_reverse($project_phids); $handles = id(new PhabricatorHandleQuery()) diff --git a/src/applications/project/phid/PhabricatorProjectPHIDTypeColumn.php b/src/applications/project/phid/PhabricatorProjectPHIDTypeColumn.php index ff2e764a94..eb22f2ce79 100644 --- a/src/applications/project/phid/PhabricatorProjectPHIDTypeColumn.php +++ b/src/applications/project/phid/PhabricatorProjectPHIDTypeColumn.php @@ -4,10 +4,6 @@ final class PhabricatorProjectPHIDTypeColumn extends PhabricatorPHIDType { const TYPECONST = 'PCOL'; - public function getTypeConstant() { - return self::TYPECONST; - } - public function getTypeName() { return pht('Project Column'); } diff --git a/src/applications/project/phid/PhabricatorProjectPHIDTypeProject.php b/src/applications/project/phid/PhabricatorProjectPHIDTypeProject.php index 9148a3e186..5b78350fae 100644 --- a/src/applications/project/phid/PhabricatorProjectPHIDTypeProject.php +++ b/src/applications/project/phid/PhabricatorProjectPHIDTypeProject.php @@ -4,10 +4,6 @@ final class PhabricatorProjectPHIDTypeProject extends PhabricatorPHIDType { const TYPECONST = 'PROJ'; - public function getTypeConstant() { - return self::TYPECONST; - } - public function getTypeName() { return pht('Project'); } diff --git a/src/applications/project/query/PhabricatorProjectQuery.php b/src/applications/project/query/PhabricatorProjectQuery.php index d4dc86e4ce..9f15c2c0ec 100644 --- a/src/applications/project/query/PhabricatorProjectQuery.php +++ b/src/applications/project/query/PhabricatorProjectQuery.php @@ -9,6 +9,7 @@ final class PhabricatorProjectQuery private $slugs; private $phrictionSlugs; private $names; + private $datasourceQuery; private $status = 'status-any'; const STATUS_ANY = 'status-any'; @@ -57,6 +58,11 @@ final class PhabricatorProjectQuery return $this; } + public function withDatasourceQuery($string) { + $this->datasourceQuery = $string; + return $this; + } + public function needMembers($need_members) { $this->needMembers = $need_members; return $this; @@ -286,7 +292,7 @@ final class PhabricatorProjectQuery } private function buildGroupClause($conn_r) { - if ($this->memberPHIDs) { + if ($this->memberPHIDs || $this->datasourceQuery) { return 'GROUP BY p.id'; } else { return $this->buildApplicationSearchGroupClause($conn_r); @@ -296,7 +302,7 @@ final class PhabricatorProjectQuery private function buildJoinClause($conn_r) { $joins = array(); - if (!$this->needMembers) { + if (!$this->needMembers !== null) { $joins[] = qsprintf( $conn_r, 'LEFT JOIN %T vm ON vm.src = p.phid AND vm.type = %d AND vm.dst = %s', @@ -305,7 +311,7 @@ final class PhabricatorProjectQuery $this->getViewer()->getPHID()); } - if ($this->memberPHIDs) { + if ($this->memberPHIDs !== null) { $joins[] = qsprintf( $conn_r, 'JOIN %T e ON e.src = p.phid AND e.type = %d', @@ -313,13 +319,32 @@ final class PhabricatorProjectQuery PhabricatorEdgeConfig::TYPE_PROJ_MEMBER); } - if ($this->slugs) { + if ($this->slugs !== null) { $joins[] = qsprintf( $conn_r, 'JOIN %T slug on slug.projectPHID = p.phid', id(new PhabricatorProjectSlug())->getTableName()); } + if ($this->datasourceQuery !== null) { + $tokens = PhabricatorTypeaheadDatasource::tokenizeString( + $this->datasourceQuery); + if (!$tokens) { + throw new PhabricatorEmptyQueryException(); + } + + $likes = array(); + foreach ($tokens as $token) { + $likes[] = qsprintf($conn_r, 'token.token LIKE %>', $token); + } + + $joins[] = qsprintf( + $conn_r, + 'JOIN %T token ON token.projectID = p.id AND (%Q)', + PhabricatorProject::TABLE_DATASOURCE_TOKEN, + '('.implode(') OR (', $likes).')'); + } + $joins[] = $this->buildApplicationSearchJoinClause($conn_r); return implode(' ', $joins); diff --git a/src/applications/project/query/PhabricatorProjectSearchEngine.php b/src/applications/project/query/PhabricatorProjectSearchEngine.php index d4057553b9..4246136682 100644 --- a/src/applications/project/query/PhabricatorProjectSearchEngine.php +++ b/src/applications/project/query/PhabricatorProjectSearchEngine.php @@ -21,7 +21,9 @@ final class PhabricatorProjectSearchEngine $saved->setParameter( 'memberPHIDs', $this->readUsersFromRequest($request, 'members')); + $saved->setParameter('status', $request->getStr('status')); + $saved->setParameter('name', $request->getStr('name')); $this->readCustomFieldsFromRequest($request, $saved); @@ -43,6 +45,11 @@ final class PhabricatorProjectSearchEngine $query->withStatus($status); } + $name = $saved->getParameter('name'); + if (strlen($name)) { + $query->withDatasourceQuery($name); + } + $this->applyCustomFieldsToQuery($query, $saved); return $query; @@ -59,11 +66,17 @@ final class PhabricatorProjectSearchEngine ->execute(); $status = $saved->getParameter('status'); + $name = $saved->getParameter('name'); $form + ->appendChild( + id(new AphrontFormTextControl()) + ->setName('name') + ->setLabel(pht('Name')) + ->setValue($name)) ->appendChild( id(new AphrontFormTokenizerControl()) - ->setDatasource('/typeahead/common/users/') + ->setDatasource(new PhabricatorPeopleDatasource()) ->setName('members') ->setLabel(pht('Members')) ->setValue($member_handles)) diff --git a/src/applications/project/storage/PhabricatorProject.php b/src/applications/project/storage/PhabricatorProject.php index 720c542392..498f3bf2a7 100644 --- a/src/applications/project/storage/PhabricatorProject.php +++ b/src/applications/project/storage/PhabricatorProject.php @@ -6,7 +6,7 @@ final class PhabricatorProject extends PhabricatorProjectDAO PhabricatorPolicyInterface, PhabricatorSubscribableInterface, PhabricatorCustomFieldInterface, - PhabricatorDestructableInterface { + PhabricatorDestructibleInterface { protected $name; protected $status = PhabricatorProjectStatus::STATUS_ACTIVE; @@ -32,6 +32,8 @@ final class PhabricatorProject extends PhabricatorProjectDAO const DEFAULT_ICON = 'fa-briefcase'; const DEFAULT_COLOR = 'blue'; + const TABLE_DATASOURCE_TOKEN = 'project_datasourcetoken'; + public static function initializeNewProject(PhabricatorUser $actor) { return id(new PhabricatorProject()) ->setName('') @@ -219,6 +221,53 @@ final class PhabricatorProject extends PhabricatorProjectDAO return $this->color; } + public function save() { + $this->openTransaction(); + $result = parent::save(); + $this->updateDatasourceTokens(); + $this->saveTransaction(); + + return $result; + } + + public function updateDatasourceTokens() { + $table = self::TABLE_DATASOURCE_TOKEN; + $conn_w = $this->establishConnection('w'); + $id = $this->getID(); + + $slugs = queryfx_all( + $conn_w, + 'SELECT * FROM %T WHERE projectPHID = %s', + id(new PhabricatorProjectSlug())->getTableName(), + $this->getPHID()); + + $all_strings = ipull($slugs, 'slug'); + $all_strings[] = $this->getName(); + $all_strings = implode(' ', $all_strings); + + $tokens = PhabricatorTypeaheadDatasource::tokenizeString($all_strings); + + $sql = array(); + foreach ($tokens as $token) { + $sql[] = qsprintf($conn_w, '(%d, %s)', $id, $token); + } + + $this->openTransaction(); + queryfx( + $conn_w, + 'DELETE FROM %T WHERE projectID = %d', + $table, + $id); + + foreach (PhabricatorLiskDAO::chunkSQL($sql) as $chunk) { + queryfx( + $conn_w, + 'INSERT INTO %T (projectID, token) VALUES %Q', + $table, + $chunk); + } + $this->saveTransaction(); + } /* -( PhabricatorSubscribableInterface )----------------------------------- */ @@ -259,7 +308,7 @@ final class PhabricatorProject extends PhabricatorProjectDAO } -/* -( PhabricatorDestructableInterface )----------------------------------- */ +/* -( PhabricatorDestructibleInterface )----------------------------------- */ public function destroyObjectPermanently( PhabricatorDestructionEngine $engine) { diff --git a/src/applications/project/storage/PhabricatorProjectColumn.php b/src/applications/project/storage/PhabricatorProjectColumn.php index 8b7d79dc7b..54f70a6714 100644 --- a/src/applications/project/storage/PhabricatorProjectColumn.php +++ b/src/applications/project/storage/PhabricatorProjectColumn.php @@ -2,8 +2,9 @@ final class PhabricatorProjectColumn extends PhabricatorProjectDAO - implements PhabricatorPolicyInterface, - PhabricatorDestructableInterface { + implements + PhabricatorPolicyInterface, + PhabricatorDestructibleInterface { const STATUS_ACTIVE = 0; const STATUS_HIDDEN = 1; @@ -99,7 +100,7 @@ final class PhabricatorProjectColumn } -/* -( PhabricatorDestructableInterface )----------------------------------- */ +/* -( PhabricatorDestructibleInterface )----------------------------------- */ public function destroyObjectPermanently( PhabricatorDestructionEngine $engine) { diff --git a/src/applications/project/typeahead/PhabricatorProjectDatasource.php b/src/applications/project/typeahead/PhabricatorProjectDatasource.php index 8b2343132d..40ffc28724 100644 --- a/src/applications/project/typeahead/PhabricatorProjectDatasource.php +++ b/src/applications/project/typeahead/PhabricatorProjectDatasource.php @@ -13,26 +13,41 @@ final class PhabricatorProjectDatasource public function loadResults() { $viewer = $this->getViewer(); + $raw_query = $this->getRawQuery(); - $results = array(); + // Allow users to type "#qa" or "qa" to find "Quality Assurance". + $raw_query = ltrim($raw_query, '#'); + + if (!strlen($raw_query)) { + return array(); + } $projs = id(new PhabricatorProjectQuery()) ->setViewer($viewer) ->needImages(true) + ->needSlugs(true) + ->withDatasourceQuery($raw_query) ->execute(); + + $results = array(); foreach ($projs as $proj) { $closed = null; if ($proj->isArchived()) { $closed = pht('Archived'); } + $all_strings = mpull($proj->getSlugs(), 'getSlug'); + $all_strings[] = $proj->getName(); + $all_strings = implode(' ', $all_strings); + $proj_result = id(new PhabricatorTypeaheadResult()) - ->setName($proj->getName()) + ->setName($all_strings) + ->setDisplayName($proj->getName()) ->setDisplayType('Project') ->setURI('/tag/'.$proj->getPrimarySlug().'/') ->setPHID($proj->getPHID()) - ->setIcon($proj->getIcon()) + ->setIcon($proj->getIcon().' bluegrey') ->setPriorityType('proj') ->setClosed($closed); diff --git a/src/applications/project/typeahead/PhabricatorProjectOrUserDatasource.php b/src/applications/project/typeahead/PhabricatorProjectOrUserDatasource.php new file mode 100644 index 0000000000..2024fa3b8b --- /dev/null +++ b/src/applications/project/typeahead/PhabricatorProjectOrUserDatasource.php @@ -0,0 +1,17 @@ +setLabel(pht('Pushers')) ->setName('pushers') - ->setDatasource('/typeahead/common/users/') + ->setDatasource(new PhabricatorPeopleDatasource()) ->setValue($pusher_handles)) ->appendChild($branch_template_input) ->appendChild($branch_template_preview) diff --git a/src/applications/releeph/phid/ReleephPHIDTypeBranch.php b/src/applications/releeph/phid/ReleephPHIDTypeBranch.php index 8978d77853..926021ef1c 100644 --- a/src/applications/releeph/phid/ReleephPHIDTypeBranch.php +++ b/src/applications/releeph/phid/ReleephPHIDTypeBranch.php @@ -4,10 +4,6 @@ final class ReleephPHIDTypeBranch extends PhabricatorPHIDType { const TYPECONST = 'REBR'; - public function getTypeConstant() { - return self::TYPECONST; - } - public function getTypeName() { return pht('Releeph Branch'); } diff --git a/src/applications/releeph/phid/ReleephPHIDTypeProduct.php b/src/applications/releeph/phid/ReleephPHIDTypeProduct.php index da7a0a63d9..61bc5c536e 100644 --- a/src/applications/releeph/phid/ReleephPHIDTypeProduct.php +++ b/src/applications/releeph/phid/ReleephPHIDTypeProduct.php @@ -4,10 +4,6 @@ final class ReleephPHIDTypeProduct extends PhabricatorPHIDType { const TYPECONST = 'REPR'; - public function getTypeConstant() { - return self::TYPECONST; - } - public function getTypeName() { return pht('Releeph Product'); } diff --git a/src/applications/releeph/phid/ReleephPHIDTypeRequest.php b/src/applications/releeph/phid/ReleephPHIDTypeRequest.php index 36466d86ff..f5352350c1 100644 --- a/src/applications/releeph/phid/ReleephPHIDTypeRequest.php +++ b/src/applications/releeph/phid/ReleephPHIDTypeRequest.php @@ -4,10 +4,6 @@ final class ReleephPHIDTypeRequest extends PhabricatorPHIDType { const TYPECONST = 'RERQ'; - public function getTypeConstant() { - return self::TYPECONST; - } - public function getTypeName() { return pht('Releeph Request'); } diff --git a/src/applications/releeph/query/ReleephRequestSearchEngine.php b/src/applications/releeph/query/ReleephRequestSearchEngine.php index cbae3ab65a..072bb334ef 100644 --- a/src/applications/releeph/query/ReleephRequestSearchEngine.php +++ b/src/applications/releeph/query/ReleephRequestSearchEngine.php @@ -84,7 +84,7 @@ final class ReleephRequestSearchEngine ->setOptions($this->getSeverityOptions())) ->appendChild( id(new AphrontFormTokenizerControl()) - ->setDatasource('/typeahead/common/users/') + ->setDatasource(new PhabricatorPeopleDatasource()) ->setName('requestors') ->setLabel(pht('Requestors')) ->setValue($requestor_handles)); diff --git a/src/applications/repository/editor/PhabricatorRepositoryEditor.php b/src/applications/repository/editor/PhabricatorRepositoryEditor.php index 700a271c84..841a65d9d1 100644 --- a/src/applications/repository/editor/PhabricatorRepositoryEditor.php +++ b/src/applications/repository/editor/PhabricatorRepositoryEditor.php @@ -225,8 +225,7 @@ final class PhabricatorRepositoryEditor $old_phid = $xaction->getOldValue(); $new_phid = $xaction->getNewValue(); - $editor = id(new PhabricatorEdgeEditor()) - ->setActor($this->requireActor()); + $editor = new PhabricatorEdgeEditor(); $edge_type = PhabricatorEdgeConfig::TYPE_OBJECT_USES_CREDENTIAL; $src_phid = $object->getPHID(); diff --git a/src/applications/repository/phid/PhabricatorRepositoryPHIDTypeArcanistProject.php b/src/applications/repository/phid/PhabricatorRepositoryPHIDTypeArcanistProject.php index e42ae18460..dcbb76b3ed 100644 --- a/src/applications/repository/phid/PhabricatorRepositoryPHIDTypeArcanistProject.php +++ b/src/applications/repository/phid/PhabricatorRepositoryPHIDTypeArcanistProject.php @@ -5,10 +5,6 @@ final class PhabricatorRepositoryPHIDTypeArcanistProject const TYPECONST = 'APRJ'; - public function getTypeConstant() { - return self::TYPECONST; - } - public function getTypeName() { return pht('Arcanist Project'); } diff --git a/src/applications/repository/phid/PhabricatorRepositoryPHIDTypeCommit.php b/src/applications/repository/phid/PhabricatorRepositoryPHIDTypeCommit.php index 62075cabfb..acd548de05 100644 --- a/src/applications/repository/phid/PhabricatorRepositoryPHIDTypeCommit.php +++ b/src/applications/repository/phid/PhabricatorRepositoryPHIDTypeCommit.php @@ -4,10 +4,6 @@ final class PhabricatorRepositoryPHIDTypeCommit extends PhabricatorPHIDType { const TYPECONST = 'CMIT'; - public function getTypeConstant() { - return self::TYPECONST; - } - public function getTypeName() { return pht('Commit'); } diff --git a/src/applications/repository/phid/PhabricatorRepositoryPHIDTypeMirror.php b/src/applications/repository/phid/PhabricatorRepositoryPHIDTypeMirror.php index 8dcf103dc8..541893844e 100644 --- a/src/applications/repository/phid/PhabricatorRepositoryPHIDTypeMirror.php +++ b/src/applications/repository/phid/PhabricatorRepositoryPHIDTypeMirror.php @@ -1,14 +1,9 @@ setValue($repository_handles)) ->appendChild( id(new AphrontFormTokenizerControl()) - ->setDatasource('/typeahead/common/accounts/') + ->setDatasource(new PhabricatorPeopleDatasource()) ->setName('pushers') ->setLabel(pht('Pushers')) ->setValue($pusher_handles)); diff --git a/src/applications/repository/query/PhabricatorRepositoryQuery.php b/src/applications/repository/query/PhabricatorRepositoryQuery.php index 23d2911dc1..8423adf486 100644 --- a/src/applications/repository/query/PhabricatorRepositoryQuery.php +++ b/src/applications/repository/query/PhabricatorRepositoryQuery.php @@ -208,7 +208,7 @@ final class PhabricatorRepositoryQuery public function didFilterPage(array $repositories) { if ($this->needProjectPHIDs) { - $type_project = PhabricatorEdgeConfig::TYPE_OBJECT_HAS_PROJECT; + $type_project = PhabricatorProjectObjectHasProjectEdgeType::EDGECONST; $edge_query = id(new PhabricatorEdgeQuery()) ->withSourcePHIDs(mpull($repositories, 'getPHID')) diff --git a/src/applications/repository/storage/PhabricatorRepository.php b/src/applications/repository/storage/PhabricatorRepository.php index d1b5e6614a..2cfd178f50 100644 --- a/src/applications/repository/storage/PhabricatorRepository.php +++ b/src/applications/repository/storage/PhabricatorRepository.php @@ -8,7 +8,7 @@ final class PhabricatorRepository extends PhabricatorRepositoryDAO PhabricatorPolicyInterface, PhabricatorFlaggableInterface, PhabricatorMarkupInterface, - PhabricatorDestructableInterface, + PhabricatorDestructibleInterface, PhabricatorProjectInterface { /** @@ -1387,7 +1387,7 @@ final class PhabricatorRepository extends PhabricatorRepositoryDAO } -/* -( PhabricatorDestructableInterface )----------------------------------- */ +/* -( PhabricatorDestructibleInterface )----------------------------------- */ public function destroyObjectPermanently( PhabricatorDestructionEngine $engine) { diff --git a/src/applications/repository/storage/PhabricatorRepositoryArcanistProject.php b/src/applications/repository/storage/PhabricatorRepositoryArcanistProject.php index 2d3b33366b..1665845cf1 100644 --- a/src/applications/repository/storage/PhabricatorRepositoryArcanistProject.php +++ b/src/applications/repository/storage/PhabricatorRepositoryArcanistProject.php @@ -2,8 +2,9 @@ final class PhabricatorRepositoryArcanistProject extends PhabricatorRepositoryDAO - implements PhabricatorPolicyInterface, - PhabricatorDestructableInterface { + implements + PhabricatorPolicyInterface, + PhabricatorDestructibleInterface { protected $name; protected $repositoryID; @@ -89,7 +90,7 @@ final class PhabricatorRepositoryArcanistProject } -/* -( PhabricatorDestructableInterface )----------------------------------- */ +/* -( PhabricatorDestructibleInterface )----------------------------------- */ public function destroyObjectPermanently( PhabricatorDestructionEngine $engine) { diff --git a/src/applications/repository/worker/commitmessageparser/PhabricatorRepositoryCommitMessageParserWorker.php b/src/applications/repository/worker/commitmessageparser/PhabricatorRepositoryCommitMessageParserWorker.php index 0296c6124c..d236cdd93b 100644 --- a/src/applications/repository/worker/commitmessageparser/PhabricatorRepositoryCommitMessageParserWorker.php +++ b/src/applications/repository/worker/commitmessageparser/PhabricatorRepositoryCommitMessageParserWorker.php @@ -90,7 +90,6 @@ abstract class PhabricatorRepositoryCommitMessageParserWorker if ($revision) { $commit_drev = PhabricatorEdgeConfig::TYPE_COMMIT_HAS_DREV; id(new PhabricatorEdgeEditor()) - ->setActor($user) ->addEdge($commit->getPHID(), $commit_drev, $revision->getPHID()) ->save(); @@ -449,29 +448,16 @@ abstract class PhabricatorRepositoryCommitMessageParserWorker foreach ($tasks as $task_id => $task) { $xactions = array(); - // TODO: Swap this for a real edge transaction once the weirdness in - // Maniphest edges is sorted out. Currently, Maniphest reacts to an edge - // edit on this edge. - id(new PhabricatorEdgeEditor()) - ->setActor($actor) - ->addEdge( - $task->getPHID(), - PhabricatorEdgeConfig::TYPE_TASK_HAS_COMMIT, - $commit->getPHID()) - ->save(); - - /* TODO: Do this instead of the above. - + $edge_type = ManiphestTaskHasCommitEdgeType::EDGECONST; $xactions[] = id(new ManiphestTransaction()) ->setTransactionType(PhabricatorTransactions::TYPE_EDGE) - ->setMetadataValue('edge:type', $edge_task_has_commit) + ->setMetadataValue('edge:type', $edge_type) ->setNewValue( array( '+' => array( $commit->getPHID() => $commit->getPHID(), ), )); - */ $status = $task_statuses[$task_id]; if ($status) { diff --git a/src/applications/search/controller/PhabricatorSearchAttachController.php b/src/applications/search/controller/PhabricatorSearchAttachController.php index a799aa7b67..bd0d575207 100644 --- a/src/applications/search/controller/PhabricatorSearchAttachController.php +++ b/src/applications/search/controller/PhabricatorSearchAttachController.php @@ -57,14 +57,52 @@ final class PhabricatorSearchAttachController $phids = array_values($phids); if ($edge_type) { - $do_txn = $object instanceof PhabricatorApplicationTransactionInterface; - $old_phids = PhabricatorEdgeQuery::loadDestinationPHIDs( - $this->phid, - $edge_type); - $add_phids = $phids; - $rem_phids = array_diff($old_phids, $add_phids); + if ($object instanceof PhabricatorRepositoryCommit) { + // TODO: Remove this entire branch of special cased grossness + // after T4896. - if ($do_txn) { + $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) @@ -78,23 +116,6 @@ final class PhabricatorSearchAttachController $txn_editor->applyTransactions( $object->getApplicationTransactionObject(), array($txn_template)); - - } else { - - $editor = id(new PhabricatorEdgeEditor()); - $editor->setActor($user); - foreach ($add_phids as $phid) { - $editor->addEdge($this->phid, $edge_type, $phid); - } - foreach ($rem_phids as $phid) { - $editor->removeEdge($this->phid, $edge_type, $phid); - } - - try { - $editor->save(); - } catch (PhabricatorEdgeCycleException $ex) { - $this->raiseGraphCycleException($ex); - } } return id(new AphrontReloadResponse())->setURI($handle->getURI()); @@ -303,17 +324,17 @@ final class PhabricatorSearchAttachController $map = array( $t_cmit => array( - $t_task => PhabricatorEdgeConfig::TYPE_COMMIT_HAS_TASK, + $t_task => DiffusionCommitHasTaskEdgeType::EDGECONST, ), $t_task => array( - $t_cmit => PhabricatorEdgeConfig::TYPE_TASK_HAS_COMMIT, + $t_cmit => ManiphestTaskHasCommitEdgeType::EDGECONST, $t_task => PhabricatorEdgeConfig::TYPE_TASK_DEPENDS_ON_TASK, - $t_drev => PhabricatorEdgeConfig::TYPE_TASK_HAS_RELATED_DREV, + $t_drev => ManiphestTaskHasRevisionEdgeType::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 => DifferentialRevisionHasTaskEdgeType::EDGECONST, ), $t_mock => array( $t_task => PhabricatorEdgeConfig::TYPE_MOCK_HAS_TASK, diff --git a/src/applications/search/engine/PhabricatorApplicationSearchEngine.php b/src/applications/search/engine/PhabricatorApplicationSearchEngine.php index c0015494ea..531f88e70d 100644 --- a/src/applications/search/engine/PhabricatorApplicationSearchEngine.php +++ b/src/applications/search/engine/PhabricatorApplicationSearchEngine.php @@ -244,7 +244,7 @@ abstract class PhabricatorApplicationSearchEngine { } protected function getApplicationClassName() { - throw new Exception(pht('Not implemented for this SearchEngine yet!')); + throw new PhutilMethodNotImplementedException(); } diff --git a/src/applications/search/query/PhabricatorSearchApplicationSearchEngine.php b/src/applications/search/query/PhabricatorSearchApplicationSearchEngine.php index 249089f380..57aa9c4db4 100644 --- a/src/applications/search/query/PhabricatorSearchApplicationSearchEngine.php +++ b/src/applications/search/query/PhabricatorSearchApplicationSearchEngine.php @@ -136,13 +136,13 @@ final class PhabricatorSearchApplicationSearchEngine id(new AphrontFormTokenizerControl()) ->setName('authorPHIDs') ->setLabel('Authors') - ->setDatasource('/typeahead/common/users/') + ->setDatasource(new PhabricatorPeopleDatasource()) ->setValue($author_handles)) ->appendChild( id(new AphrontFormTokenizerControl()) ->setName('ownerPHIDs') ->setLabel('Owners') - ->setDatasource('/typeahead/common/searchowner/') + ->setDatasource(new PhabricatorTypeaheadOwnerDatasource()) ->setValue($owner_handles)) ->appendChild( id(new AphrontFormCheckboxControl()) @@ -155,7 +155,7 @@ final class PhabricatorSearchApplicationSearchEngine id(new AphrontFormTokenizerControl()) ->setName('subscriberPHIDs') ->setLabel('Subscribers') - ->setDatasource('/typeahead/common/users/') + ->setDatasource(new PhabricatorPeopleDatasource()) ->setValue($subscriber_handles)) ->appendChild( id(new AphrontFormTokenizerControl()) diff --git a/src/applications/search/typeahead/PhabricatorSearchDatasource.php b/src/applications/search/typeahead/PhabricatorSearchDatasource.php new file mode 100644 index 0000000000..9cbd8d477a --- /dev/null +++ b/src/applications/search/typeahead/PhabricatorSearchDatasource.php @@ -0,0 +1,24 @@ +setEnrichResults(true), + new PhabricatorProjectDatasource(), + new PhabricatorApplicationDatasource(), + new PhabricatorTypeaheadMonogramDatasource(), + new DiffusionSymbolDatasource(), + ); + } + +} diff --git a/src/applications/slowvote/controller/PhabricatorSlowvoteEditController.php b/src/applications/slowvote/controller/PhabricatorSlowvoteEditController.php index 1f2766a43b..57e18d760f 100644 --- a/src/applications/slowvote/controller/PhabricatorSlowvoteEditController.php +++ b/src/applications/slowvote/controller/PhabricatorSlowvoteEditController.php @@ -38,7 +38,7 @@ final class PhabricatorSlowvoteEditController } else { $v_projects = PhabricatorEdgeQuery::loadDestinationPHIDs( $poll->getPHID(), - PhabricatorEdgeConfig::TYPE_OBJECT_HAS_PROJECT); + PhabricatorProjectObjectHasProjectEdgeType::EDGECONST); $v_projects = array_reverse($v_projects); } @@ -105,7 +105,7 @@ final class PhabricatorSlowvoteEditController ->setNewValue($v_view_policy); if (empty($errors)) { - $proj_edge_type = PhabricatorEdgeConfig::TYPE_OBJECT_HAS_PROJECT; + $proj_edge_type = PhabricatorProjectObjectHasProjectEdgeType::EDGECONST; $xactions[] = id(new PhabricatorSlowvoteTransaction()) ->setTransactionType(PhabricatorTransactions::TYPE_EDGE) ->setMetadataValue('edge:type', $proj_edge_type) diff --git a/src/applications/slowvote/phid/PhabricatorSlowvotePHIDTypePoll.php b/src/applications/slowvote/phid/PhabricatorSlowvotePHIDTypePoll.php index 36ad531375..834b70c698 100644 --- a/src/applications/slowvote/phid/PhabricatorSlowvotePHIDTypePoll.php +++ b/src/applications/slowvote/phid/PhabricatorSlowvotePHIDTypePoll.php @@ -4,10 +4,6 @@ final class PhabricatorSlowvotePHIDTypePoll extends PhabricatorPHIDType { const TYPECONST = 'POLL'; - public function getTypeConstant() { - return self::TYPECONST; - } - public function getTypeName() { return pht('Slowvote Poll'); } diff --git a/src/applications/slowvote/query/PhabricatorSlowvoteSearchEngine.php b/src/applications/slowvote/query/PhabricatorSlowvoteSearchEngine.php index d822e740be..e0e8baf0ba 100644 --- a/src/applications/slowvote/query/PhabricatorSlowvoteSearchEngine.php +++ b/src/applications/slowvote/query/PhabricatorSlowvoteSearchEngine.php @@ -55,7 +55,7 @@ final class PhabricatorSlowvoteSearchEngine $form ->appendChild( id(new AphrontFormTokenizerControl()) - ->setDatasource('/typeahead/common/users/') + ->setDatasource(new PhabricatorPeopleDatasource()) ->setName('authors') ->setLabel(pht('Authors')) ->setValue($author_handles)) diff --git a/src/applications/subscriptions/editor/PhabricatorSubscriptionsEditor.php b/src/applications/subscriptions/editor/PhabricatorSubscriptionsEditor.php index ab73feda8b..9b58b61797 100644 --- a/src/applications/subscriptions/editor/PhabricatorSubscriptionsEditor.php +++ b/src/applications/subscriptions/editor/PhabricatorSubscriptionsEditor.php @@ -83,8 +83,7 @@ final class PhabricatorSubscriptionsEditor extends PhabricatorEditor { $u_type = PhabricatorEdgeConfig::TYPE_OBJECT_HAS_UNSUBSCRIBER; $s_type = PhabricatorEdgeConfig::TYPE_OBJECT_HAS_SUBSCRIBER; - $editor = id(new PhabricatorEdgeEditor()) - ->setActor($actor); + $editor = new PhabricatorEdgeEditor(); foreach ($add as $phid => $ignored) { $editor->removeEdge($src, $u_type, $phid); diff --git a/src/applications/system/engine/PhabricatorDestructionEngine.php b/src/applications/system/engine/PhabricatorDestructionEngine.php index 7b40c26726..4c49ac6ae2 100644 --- a/src/applications/system/engine/PhabricatorDestructionEngine.php +++ b/src/applications/system/engine/PhabricatorDestructionEngine.php @@ -4,7 +4,7 @@ final class PhabricatorDestructionEngine extends Phobject { private $rootLogID; - public function destroyObject(PhabricatorDestructableInterface $object) { + public function destroyObject(PhabricatorDestructibleInterface $object) { $log = id(new PhabricatorSystemDestructionLog()) ->setEpoch(time()) ->setObjectClass(get_class($object)); @@ -62,8 +62,7 @@ final class PhabricatorDestructionEngine extends Phobject { return; } - $editor = id(new PhabricatorEdgeEditor()) - ->setSuppressEvents(true); + $editor = new PhabricatorEdgeEditor(); foreach ($edges as $type => $type_edges) { foreach ($type_edges as $src => $src_edges) { foreach ($src_edges as $dst => $edge) { diff --git a/src/applications/system/interface/PhabricatorDestructableInterface.php b/src/applications/system/interface/PhabricatorDestructibleInterface.php similarity index 89% rename from src/applications/system/interface/PhabricatorDestructableInterface.php rename to src/applications/system/interface/PhabricatorDestructibleInterface.php index 6130789f3a..3b69f87c3a 100644 --- a/src/applications/system/interface/PhabricatorDestructableInterface.php +++ b/src/applications/system/interface/PhabricatorDestructibleInterface.php @@ -1,6 +1,6 @@ $object) { - if (!($object instanceof PhabricatorDestructableInterface)) { + if (!($object instanceof PhabricatorDestructibleInterface)) { throw new PhutilArgumentUsageException( pht( 'Object "%s" can not be destroyed (it does not implement %s).', $object_name, - 'PhabricatorDestructableInterface')); + 'PhabricatorDestructibleInterface')); } } diff --git a/src/applications/tokens/phid/PhabricatorTokenPHIDTypeToken.php b/src/applications/tokens/phid/PhabricatorTokenPHIDTypeToken.php index c641a1efbd..ee5e5375ab 100644 --- a/src/applications/tokens/phid/PhabricatorTokenPHIDTypeToken.php +++ b/src/applications/tokens/phid/PhabricatorTokenPHIDTypeToken.php @@ -4,10 +4,6 @@ final class PhabricatorTokenPHIDTypeToken extends PhabricatorPHIDType { const TYPECONST = 'TOKN'; - public function getTypeConstant() { - return self::TYPECONST; - } - public function getTypeName() { return pht('Token'); } diff --git a/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php b/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php index 6d27ac7895..84bf634ff4 100644 --- a/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php +++ b/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php @@ -24,6 +24,7 @@ abstract class PhabricatorApplicationTransactionEditor private $isPreview; private $isHeraldEditor; + private $isInverseEdgeEditor; private $actingAsPHID; private $disableEmail; @@ -120,6 +121,15 @@ abstract class PhabricatorApplicationTransactionEditor 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; @@ -317,7 +327,7 @@ abstract class PhabricatorApplicationTransactionEditor protected function applyInitialEffects( PhabricatorLiskDAO $object, array $xactions) { - throw new Exception('Not implemented.'); + throw new PhutilMethodNotImplementedException(); } private function applyInternalEffects( @@ -377,17 +387,31 @@ abstract class PhabricatorApplicationTransactionEditor 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::getByConstant($const); + if ($type->shouldWriteInverseTransactions()) { + $this->applyInverseEdgeTransactions( + $object, + $xaction, + $type->getInverseEdgeConstant()); + } foreach ($new as $dst_phid => $edge) { $new[$dst_phid]['src'] = $src; } - $editor = id(new PhabricatorEdgeEditor()) - ->setActor($this->getActor()); + $editor = new PhabricatorEdgeEditor(); foreach ($old as $dst_phid => $edge) { if (!empty($new[$dst_phid])) { @@ -395,7 +419,7 @@ abstract class PhabricatorApplicationTransactionEditor continue; } } - $editor->removeEdge($src, $type, $dst_phid); + $editor->removeEdge($src, $const, $dst_phid); } foreach ($new as $dst_phid => $edge) { @@ -409,7 +433,7 @@ abstract class PhabricatorApplicationTransactionEditor 'data' => $edge['data'], ); - $editor->addEdge($src, $type, $dst_phid, $data); + $editor->addEdge($src, $const, $dst_phid, $data); } $editor->save(); @@ -1129,7 +1153,7 @@ abstract class PhabricatorApplicationTransactionEditor } if ($phids) { - $edge_type = PhabricatorEdgeConfig::TYPE_OBJECT_HAS_PROJECT; + $edge_type = PhabricatorProjectObjectHasProjectEdgeType::EDGECONST; $block_xactions[] = newv(get_class(head($xactions)), array()) ->setIgnoreOnNoEffect(true) ->setTransactionType(PhabricatorTransactions::TYPE_EDGE) @@ -1946,7 +1970,7 @@ abstract class PhabricatorApplicationTransactionEditor if ($object instanceof PhabricatorProjectInterface) { $project_phids = PhabricatorEdgeQuery::loadDestinationPHIDs( $object->getPHID(), - PhabricatorEdgeConfig::TYPE_OBJECT_HAS_PROJECT); + PhabricatorProjectObjectHasProjectEdgeType::EDGECONST); } else { $project_phids = $object->getProjectPHIDs(); } @@ -2321,13 +2345,7 @@ abstract class PhabricatorApplicationTransactionEditor return; } - $editor = id(new PhabricatorEdgeEditor()) - ->setActor($this->getActor()); - - // TODO: Edge-based events were almost certainly a terrible idea. If we - // don't suppress this event, the Maniphest listener reenters and adds - // more transactions. Just suppress it until that can get cleaned up. - $editor->setSuppressEvents(true); + $editor = new PhabricatorEdgeEditor(); $src = $object->getPHID(); $type = PhabricatorEdgeConfig::TYPE_OBJECT_HAS_FILE; @@ -2338,4 +2356,59 @@ abstract class PhabricatorApplicationTransactionEditor $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/applications/transactions/phid/PhabricatorApplicationTransactionPHIDTypeTransaction.php b/src/applications/transactions/phid/PhabricatorApplicationTransactionPHIDTypeTransaction.php index 97841ba04f..195686d7bb 100644 --- a/src/applications/transactions/phid/PhabricatorApplicationTransactionPHIDTypeTransaction.php +++ b/src/applications/transactions/phid/PhabricatorApplicationTransactionPHIDTypeTransaction.php @@ -5,10 +5,6 @@ final class PhabricatorApplicationTransactionPHIDTypeTransaction const TYPECONST = 'XACT'; - public function getTypeConstant() { - return self::TYPECONST; - } - public function getTypeName() { return pht('Transaction'); } diff --git a/src/applications/transactions/storage/PhabricatorApplicationTransaction.php b/src/applications/transactions/storage/PhabricatorApplicationTransaction.php index 630dbb60ee..1469bfb6d6 100644 --- a/src/applications/transactions/storage/PhabricatorApplicationTransaction.php +++ b/src/applications/transactions/storage/PhabricatorApplicationTransaction.php @@ -4,7 +4,7 @@ abstract class PhabricatorApplicationTransaction extends PhabricatorLiskDAO implements PhabricatorPolicyInterface, - PhabricatorDestructableInterface { + PhabricatorDestructibleInterface { const TARGET_TEXT = 'text'; const TARGET_HTML = 'html'; @@ -76,7 +76,7 @@ abstract class PhabricatorApplicationTransaction } public function getApplicationTransactionCommentObject() { - throw new Exception('Not implemented!'); + throw new PhutilMethodNotImplementedException(); } public function getApplicationTransactionViewObject() { @@ -591,28 +591,25 @@ abstract class PhabricatorApplicationTransaction $type = $this->getMetadata('edge:type'); $type = head($type); + $type_obj = PhabricatorEdgeType::getByConstant($type); + if ($add && $rem) { - $string = PhabricatorEdgeConfig::getEditStringForEdgeType($type); - return pht( - $string, + return $type_obj->getTransactionEditString( $this->renderHandleLink($author_phid), - count($add), + new PhutilNumber(count($add) + count($rem)), + new PhutilNumber(count($add)), $this->renderHandleList($add), - count($rem), + new PhutilNumber(count($rem)), $this->renderHandleList($rem)); } else if ($add) { - $string = PhabricatorEdgeConfig::getAddStringForEdgeType($type); - return pht( - $string, + return $type_obj->getTransactionAddString( $this->renderHandleLink($author_phid), - count($add), + new PhutilNumber(count($add)), $this->renderHandleList($add)); } else if ($rem) { - $string = PhabricatorEdgeConfig::getRemoveStringForEdgeType($type); - return pht( - $string, + return $type_obj->getTransactionRemoveString( $this->renderHandleLink($author_phid), - count($rem), + new PhutilNumber(count($rem)), $this->renderHandleList($rem)); } else { return pht( @@ -711,13 +708,43 @@ abstract class PhabricatorApplicationTransaction $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid)); case PhabricatorTransactions::TYPE_EDGE: + $new = ipull($new, 'dst'); + $old = ipull($old, 'dst'); + $add = array_diff($new, $old); + $rem = array_diff($old, $new); $type = $this->getMetadata('edge:type'); $type = head($type); - $string = PhabricatorEdgeConfig::getFeedStringForEdgeType($type); - return pht( - $string, - $this->renderHandleLink($author_phid), - $this->renderHandleLink($object_phid)); + + $type_obj = PhabricatorEdgeType::getByConstant($type); + + if ($add && $rem) { + return $type_obj->getFeedEditString( + $this->renderHandleLink($author_phid), + $this->renderHandleLink($object_phid), + new PhutilNumber(count($add) + count($rem)), + new PhutilNumber(count($add)), + $this->renderHandleList($add), + new PhutilNumber(count($rem)), + $this->renderHandleList($rem)); + } else if ($add) { + return $type_obj->getFeedAddString( + $this->renderHandleLink($author_phid), + $this->renderHandleLink($object_phid), + new PhutilNumber(count($add)), + $this->renderHandleList($add)); + } else if ($rem) { + return $type_obj->getFeedRemoveString( + $this->renderHandleLink($author_phid), + $this->renderHandleLink($object_phid), + new PhutilNumber(count($rem)), + $this->renderHandleList($rem)); + } else { + return pht( + '%s edited edge metadata for %s.', + $this->renderHandleLink($author_phid), + $this->renderHandleLink($object_phid)); + } + case PhabricatorTransactions::TYPE_CUSTOMFIELD: $field = $this->getTransactionCustomField(); if ($field) { @@ -999,7 +1026,7 @@ abstract class PhabricatorApplicationTransaction } -/* -( PhabricatorDestructableInterface )----------------------------------- */ +/* -( PhabricatorDestructibleInterface )----------------------------------- */ public function destroyObjectPermanently( diff --git a/src/applications/transactions/storage/PhabricatorApplicationTransactionComment.php b/src/applications/transactions/storage/PhabricatorApplicationTransactionComment.php index 318c3249b1..deaf110ea4 100644 --- a/src/applications/transactions/storage/PhabricatorApplicationTransactionComment.php +++ b/src/applications/transactions/storage/PhabricatorApplicationTransactionComment.php @@ -5,7 +5,7 @@ abstract class PhabricatorApplicationTransactionComment implements PhabricatorMarkupInterface, PhabricatorPolicyInterface, - PhabricatorDestructableInterface { + PhabricatorDestructibleInterface { const MARKUP_FIELD_COMMENT = 'markup:comment'; @@ -135,7 +135,7 @@ abstract class PhabricatorApplicationTransactionComment } -/* -( PhabricatorDestructableInterface )----------------------------------- */ +/* -( PhabricatorDestructibleInterface )----------------------------------- */ public function destroyObjectPermanently( PhabricatorDestructionEngine $engine) { diff --git a/src/applications/typeahead/application/PhabricatorApplicationTypeahead.php b/src/applications/typeahead/application/PhabricatorApplicationTypeahead.php index 5a8a0b69f2..0e5c0afd4f 100644 --- a/src/applications/typeahead/application/PhabricatorApplicationTypeahead.php +++ b/src/applications/typeahead/application/PhabricatorApplicationTypeahead.php @@ -5,8 +5,6 @@ final class PhabricatorApplicationTypeahead extends PhabricatorApplication { public function getRoutes() { return array( '/typeahead/' => array( - 'common/(?P\w+)/' - => 'PhabricatorTypeaheadCommonDatasourceController', 'class/(?:(?P\w+)/)?' => 'PhabricatorTypeaheadModularDatasourceController', ), diff --git a/src/applications/typeahead/controller/PhabricatorTypeaheadCommonDatasourceController.php b/src/applications/typeahead/controller/PhabricatorTypeaheadCommonDatasourceController.php deleted file mode 100644 index b424ea00a8..0000000000 --- a/src/applications/typeahead/controller/PhabricatorTypeaheadCommonDatasourceController.php +++ /dev/null @@ -1,345 +0,0 @@ -type = $data['type']; - } - - public function processRequest() { - $request = $this->getRequest(); - $viewer = $request->getUser(); - $query = $request->getStr('q'); - $raw_query = $request->getStr('raw'); - - $need_rich_data = false; - - $need_users = false; - $need_agents = false; - $need_applications = false; - $need_lists = false; - $need_projs = false; - $need_packages = false; - $need_upforgrabs = false; - $need_noproject = false; - $need_symbols = false; - $need_jump_objects = false; - switch ($this->type) { - case 'mainsearch': - $need_users = true; - $need_applications = true; - $need_rich_data = true; - $need_symbols = true; - $need_projs = true; - $need_jump_objects = true; - break; - case 'searchowner': - $need_users = true; - $need_upforgrabs = true; - break; - case 'searchproject': - $need_projs = true; - $need_noproject = true; - break; - case 'users': - case 'accounts': - case 'authors': - $need_users = true; - break; - case 'mailable': - case 'allmailable': - $need_users = true; - $need_lists = true; - $need_projs = true; - break; - case 'usersorprojects': - case 'accountsorprojects': - $need_users = true; - $need_projs = true; - break; - case 'usersprojectsorpackages': - $need_users = true; - $need_projs = true; - $need_packages = true; - break; - } - - $results = array(); - - if ($need_upforgrabs) { - $results[] = id(new PhabricatorTypeaheadResult()) - ->setName('upforgrabs (Up For Grabs)') - ->setPHID(ManiphestTaskOwner::OWNER_UP_FOR_GRABS); - } - - if ($need_noproject) { - $results[] = id(new PhabricatorTypeaheadResult()) - ->setName('noproject (No Project)') - ->setPHID(ManiphestTaskOwner::PROJECT_NO_PROJECT); - } - - - if ($need_users) { - $columns = array( - 'isSystemAgent', - 'isAdmin', - 'isDisabled', - 'userName', - 'realName', - 'phid'); - - if ($query) { - // This is an arbitrary limit which is just larger than any limit we - // actually use in the application. - - // TODO: The datasource should pass this in the query. - $limit = 15; - - $user_table = new PhabricatorUser(); - $conn_r = $user_table->establishConnection('r'); - $ids = queryfx_all( - $conn_r, - 'SELECT id FROM %T WHERE username LIKE %> - ORDER BY username ASC LIMIT %d', - $user_table->getTableName(), - $query, - $limit); - $ids = ipull($ids, 'id'); - - if (count($ids) < $limit) { - // If we didn't find enough username hits, look for real name hits. - // We need to pull the entire pagesize so that we end up with the - // right number of items if this query returns many duplicate IDs - // that we've already selected. - - $realname_ids = queryfx_all( - $conn_r, - 'SELECT DISTINCT userID FROM %T WHERE token LIKE %> - ORDER BY token ASC LIMIT %d', - PhabricatorUser::NAMETOKEN_TABLE, - $query, - $limit); - $realname_ids = ipull($realname_ids, 'userID'); - $ids = array_merge($ids, $realname_ids); - - $ids = array_unique($ids); - $ids = array_slice($ids, 0, $limit); - } - - // Always add the logged-in user because some tokenizers autosort them - // first. They'll be filtered out on the client side if they don't - // match the query. - $ids[] = $request->getUser()->getID(); - - if ($ids) { - $users = id(new PhabricatorUser())->loadColumnsWhere( - $columns, - 'id IN (%Ld)', - $ids); - } else { - $users = array(); - } - } else { - $users = id(new PhabricatorUser())->loadColumns($columns); - } - - if ($need_rich_data) { - $phids = mpull($users, 'getPHID'); - $handles = $this->loadViewerHandles($phids); - } - - foreach ($users as $user) { - $closed = null; - if ($user->getIsDisabled()) { - $closed = pht('Disabled'); - } else if ($user->getIsSystemAgent()) { - $closed = pht('Bot/Script'); - } - - $result = id(new PhabricatorTypeaheadResult()) - ->setName($user->getFullName()) - ->setURI('/p/'.$user->getUsername()) - ->setPHID($user->getPHID()) - ->setPriorityString($user->getUsername()) - ->setIcon('fa-user bluegrey') - ->setPriorityType('user') - ->setClosed($closed); - - if ($need_rich_data) { - $display_type = 'User'; - if ($user->getIsAdmin()) { - $display_type = 'Administrator'; - } - $result->setDisplayType($display_type); - $result->setImageURI($handles[$user->getPHID()]->getImageURI()); - } - $results[] = $result; - } - } - - if ($need_lists) { - $lists = id(new PhabricatorMailingListQuery()) - ->setViewer($viewer) - ->execute(); - foreach ($lists as $list) { - $results[] = id(new PhabricatorTypeaheadResult()) - ->setName($list->getName()) - ->setURI($list->getURI()) - ->setPHID($list->getPHID()); - } - } - - if ($need_projs) { - $projs = id(new PhabricatorProjectQuery()) - ->setViewer($viewer) - ->needImages(true) - ->execute(); - foreach ($projs as $proj) { - $closed = null; - if ($proj->isArchived()) { - $closed = pht('Archived'); - } - - $proj_result = id(new PhabricatorTypeaheadResult()) - ->setName($proj->getName()) - ->setDisplayType('Project') - ->setURI('/project/view/'.$proj->getID().'/') - ->setPHID($proj->getPHID()) - ->setIcon($proj->getIcon()) - ->setPriorityType('proj') - ->setClosed($closed); - - $proj_result->setImageURI($proj->getProfileImageURI()); - - $results[] = $proj_result; - } - } - - if ($need_packages) { - $packages = id(new PhabricatorOwnersPackage())->loadAll(); - foreach ($packages as $package) { - $results[] = id(new PhabricatorTypeaheadResult()) - ->setIcon('fa-list-alt bluegrey') - ->setName($package->getName()) - ->setURI('/owners/package/'.$package->getID().'/') - ->setPHID($package->getPHID()); - } - } - - if ($need_applications) { - $applications = PhabricatorApplication::getAllInstalledApplications(); - foreach ($applications as $application) { - $uri = $application->getTypeaheadURI(); - if (!$uri) { - continue; - } - $name = $application->getName().' '.$application->getShortDescription(); - $img = 'apps-'.$application->getIconName().'-dark-large'; - $results[] = id(new PhabricatorTypeaheadResult()) - ->setName($name) - ->setURI($uri) - ->setPHID($application->getPHID()) - ->setPriorityString($application->getName()) - ->setDisplayName($application->getName()) - ->setDisplayType($application->getShortDescription()) - ->setImageuRI($application->getIconURI()) - ->setPriorityType('apps') - ->setImageSprite('phabricator-search-icon sprite-apps-large '.$img); - } - } - - if ($need_symbols) { - $symbols = id(new DiffusionSymbolQuery()) - ->setNamePrefix($query) - ->setLimit(15) - ->needArcanistProjects(true) - ->needRepositories(true) - ->needPaths(true) - ->execute(); - foreach ($symbols as $symbol) { - $lang = $symbol->getSymbolLanguage(); - $name = $symbol->getSymbolName(); - $type = $symbol->getSymbolType(); - $proj = $symbol->getArcanistProject()->getName(); - - $results[] = id(new PhabricatorTypeaheadResult()) - ->setName($name) - ->setURI($symbol->getURI()) - ->setPHID(md5($symbol->getURI())) // Just needs to be unique. - ->setDisplayName($name) - ->setDisplayType(strtoupper($lang).' '.ucwords($type).' ('.$proj.')') - ->setPriorityType('symb'); - } - } - - if ($need_jump_objects) { - $objects = id(new PhabricatorObjectQuery()) - ->setViewer($viewer) - ->withNames(array($raw_query)) - ->execute(); - if ($objects) { - $handles = id(new PhabricatorHandleQuery()) - ->setViewer($viewer) - ->withPHIDs(mpull($objects, 'getPHID')) - ->execute(); - $handle = head($handles); - if ($handle) { - $results[] = id(new PhabricatorTypeaheadResult()) - ->setName($handle->getFullName()) - ->setDisplayType($handle->getTypeName()) - ->setURI($handle->getURI()) - ->setPHID($handle->getPHID()) - ->setPriorityType('jump'); - } - } - } - - $content = mpull($results, 'getWireFormat'); - - if ($request->isAjax()) { - return id(new AphrontAjaxResponse())->setContent($content); - } - - // If there's a non-Ajax request to this endpoint, show results in a tabular - // format to make it easier to debug typeahead output. - - $rows = array(); - foreach ($results as $result) { - $wire = $result->getWireFormat(); - $rows[] = $wire; - } - - $table = new AphrontTableView($rows); - $table->setHeaders( - array( - 'Name', - 'URI', - 'PHID', - 'Priority', - 'Display Name', - 'Display Type', - 'Image URI', - 'Priority Type', - 'Sprite Class', - )); - - $panel = new AphrontPanelView(); - $panel->setHeader('Typeahead Results'); - $panel->appendChild($table); - - return $this->buildStandardPageResponse( - $panel, - array( - 'title' => pht('Typeahead Results'), - 'device' => true - )); - } - -} diff --git a/src/applications/typeahead/controller/PhabricatorTypeaheadModularDatasourceController.php b/src/applications/typeahead/controller/PhabricatorTypeaheadModularDatasourceController.php index 98c0d40d88..f08538977d 100644 --- a/src/applications/typeahead/controller/PhabricatorTypeaheadModularDatasourceController.php +++ b/src/applications/typeahead/controller/PhabricatorTypeaheadModularDatasourceController.php @@ -86,14 +86,17 @@ final class PhabricatorTypeaheadModularDatasourceController $table = new AphrontTableView($content); $table->setHeaders( array( - 'Name', - 'URI', - 'PHID', - 'Priority', - 'Display Name', - 'Display Type', - 'Image URI', - 'Priority Type', + pht('Name'), + pht('URI'), + pht('PHID'), + pht('Priority'), + pht('Display Name'), + pht('Display Type'), + pht('Image URI'), + pht('Priority Type'), + pht('Icon'), + pht('Closed'), + pht('Sprite'), )); $result_box = id(new PHUIObjectBoxView()) diff --git a/src/applications/typeahead/datasource/PhabricatorTypeaheadDatasource.php b/src/applications/typeahead/datasource/PhabricatorTypeaheadDatasource.php index 7ec636dda0..7ce5f5ab33 100644 --- a/src/applications/typeahead/datasource/PhabricatorTypeaheadDatasource.php +++ b/src/applications/typeahead/datasource/PhabricatorTypeaheadDatasource.php @@ -51,4 +51,15 @@ abstract class PhabricatorTypeaheadDatasource extends Phobject { abstract public function getDatasourceApplicationClass(); abstract public function loadResults(); + public static function tokenizeString($string) { + $string = phutil_utf8_strtolower($string); + $string = trim($string); + if (!strlen($string)) { + return array(); + } + + $tokens = preg_split('/\s+/', $string); + return array_unique($tokens); + } + } diff --git a/src/applications/typeahead/datasource/PhabricatorTypeaheadNoOwnerDatasource.php b/src/applications/typeahead/datasource/PhabricatorTypeaheadNoOwnerDatasource.php new file mode 100644 index 0000000000..76dd3148d8 --- /dev/null +++ b/src/applications/typeahead/datasource/PhabricatorTypeaheadNoOwnerDatasource.php @@ -0,0 +1,28 @@ +getViewer(); + $raw_query = $this->getRawQuery(); + + $results = array(); + + $results[] = id(new PhabricatorTypeaheadResult()) + ->setName(pht('None')) + ->setIcon('fa-ban orange') + ->setPHID(ManiphestTaskOwner::OWNER_UP_FOR_GRABS); + + return $results; + } + +} diff --git a/src/applications/typeahead/datasource/PhabricatorTypeaheadOwnerDatasource.php b/src/applications/typeahead/datasource/PhabricatorTypeaheadOwnerDatasource.php new file mode 100644 index 0000000000..a2aaf4f991 --- /dev/null +++ b/src/applications/typeahead/datasource/PhabricatorTypeaheadOwnerDatasource.php @@ -0,0 +1,17 @@ +displayType, $this->imageURI ? (string)$this->imageURI : null, $this->priorityType, - $this->icon, + ($this->icon === null) ? $this->getDefaultIcon() : $this->icon, $this->closed, $this->imageSprite ? (string)$this->imageSprite : null, ); @@ -89,4 +89,32 @@ final class PhabricatorTypeaheadResult { return $data; } + /** + * If the datasource did not specify an icon explicitly, try to select a + * default based on PHID type. + */ + private function getDefaultIcon() { + static $icon_map; + if ($icon_map === null) { + $types = PhabricatorPHIDType::getAllTypes(); + + $map = array(); + foreach ($types as $type) { + $icon = $type->getTypeIcon(); + if ($icon !== null) { + $map[$type->getTypeConstant()] = "{$icon} bluegrey"; + } + } + + $icon_map = $map; + } + + $phid_type = phid_get_type($this->phid); + if (isset($icon_map[$phid_type])) { + return $icon_map[$phid_type]; + } + + return null; + } + } diff --git a/src/docs/user/userguide/arcanist_lint_unit.diviner b/src/docs/user/userguide/arcanist_lint_unit.diviner index d9cc107440..3b12de9dac 100644 --- a/src/docs/user/userguide/arcanist_lint_unit.diviner +++ b/src/docs/user/userguide/arcanist_lint_unit.diviner @@ -17,7 +17,7 @@ you need to build new classes. For instance: - if you want to configure linters, or add new linters, you need to create a new class which extends @{class@arcanist:ArcanistLintEngine}. - if you want to integrate with a unit testing framework, you need to create a - new class which extends @{class@arcanist:ArcanistBaseUnitTestEngine}. + new class which extends @{class@arcanist:ArcanistUnitTestEngine}. - if you you want to change how workflows behave, or add new workflows, you need to create a new class which extends @{class@arcanist:ArcanistConfiguration}. diff --git a/src/docs/user/userguide/arcanist_new_project.diviner b/src/docs/user/userguide/arcanist_new_project.diviner index 106ec6f8f8..fbb2ad4a45 100644 --- a/src/docs/user/userguide/arcanist_new_project.diviner +++ b/src/docs/user/userguide/arcanist_new_project.diviner @@ -59,7 +59,7 @@ Other options include: @{class@arcanist:ArcanistLintEngine}, which should be used to apply lint rules to this project. See @{article:Arcanist User Guide: Lint}. - **unit.engine**: the name of a subclass of - @{class@arcanist:ArcanistBaseUnitTestEngine}, which should be used to apply + @{class@arcanist:ArcanistUnitTestEngine}, which should be used to apply unit test rules to this project. See @{article:Arcanist User Guide: Customizing Lint, Unit Tests and Workflows}. diff --git a/src/docs/user/userguide/events.diviner b/src/docs/user/userguide/events.diviner index 292be9ec45..3cfa38e3c6 100644 --- a/src/docs/user/userguide/events.diviner +++ b/src/docs/user/userguide/events.diviner @@ -91,7 +91,7 @@ Arcanist event constants are listed in @{class@arcanist:ArcanistEventType}. All Arcanist events have this data available: - - `workflow` The active @{class@arcanist:ArcanistBaseWorkflow}. + - `workflow` The active @{class@arcanist:ArcanistWorkflow}. == Arcanist: Commit: Will Commit SVN == @@ -236,40 +236,6 @@ Data available on this event: Using @{class@libphutil:PhutilEmailAddress} may be helpful in parsing the query. -== Edge: Will Edit Edges == - -NOTE: Edge events are low-level events deep in the core. It is more difficult to -correct implement listeners for these events than for higher-level events. - -The constant for this event is -`PhabricatorEventType::TYPE_EDGE_WILLEDITEDGES`. - -This event is dispatched before @{class:PhabricatorEdgeEditor} makes an edge -edit. - - - `id` An identifier for this edit operation. - - `add` A list of dictionaries, each representing a new edge. - - `rem` A list of dictionaries, each representing a removed edge. - -This is similar to the next event (did edit edges) but occurs before the -edit begins. - -== Edge: Did Edit Edges == - -The constant for this event is -`PhabricatorEventType::TYPE_EDGE_DIDEDITEDGES`. - -This event is dispatched after @{class:PhabricatorEdgeEditor} makes an edge -edit, but before it commits the transactions. Data available on this event: - - - `id` An identifier for this edit operation. This is the same ID as - the one included in the corresponding "will edit edges" event. - - `add` A list of dictionaries, each representing a new edge. - - `rem` A list of dictionaries, each representing a removed edge. - -This is similar to the previous event (will edit edges) but occurs after the -edit completes. - == Search: Did Update Index == The constant for this event is diff --git a/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldUsers.php b/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldUsers.php index 2ff1d4589c..440ac7dab7 100644 --- a/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldUsers.php +++ b/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldUsers.php @@ -18,7 +18,7 @@ final class PhabricatorStandardCustomFieldUsers $control = id(new AphrontFormTokenizerControl()) ->setLabel($this->getFieldName()) ->setName($this->getFieldKey()) - ->setDatasource('/typeahead/common/accounts/') + ->setDatasource(new PhabricatorPeopleDatasource()) ->setCaption($this->getCaption()) ->setValue($control_value); @@ -39,7 +39,7 @@ final class PhabricatorStandardCustomFieldUsers $control = id(new AphrontFormTokenizerControl()) ->setLabel($this->getFieldName()) ->setName($this->getFieldKey()) - ->setDatasource('/typeahead/common/accounts/') + ->setDatasource(new PhabricatorPeopleDatasource()) ->setValue($handles); $form->appendChild($control); diff --git a/src/infrastructure/edges/__tests__/PhabricatorEdgeTestCase.php b/src/infrastructure/edges/__tests__/PhabricatorEdgeTestCase.php index d15ed23c61..48dffdc9f5 100644 --- a/src/infrastructure/edges/__tests__/PhabricatorEdgeTestCase.php +++ b/src/infrastructure/edges/__tests__/PhabricatorEdgeTestCase.php @@ -21,7 +21,6 @@ final class PhabricatorEdgeTestCase extends PhabricatorTestCase { $phid2 = $obj2->getPHID(); $editor = id(new PhabricatorEdgeEditor()) - ->setActor($user) ->addEdge($phid1, PhabricatorEdgeConfig::TYPE_TEST_NO_CYCLE, $phid2) ->addEdge($phid2, PhabricatorEdgeConfig::TYPE_TEST_NO_CYCLE, $phid1); @@ -39,12 +38,10 @@ final class PhabricatorEdgeTestCase extends PhabricatorTestCase { // fail (it introduces a cycle). $editor = id(new PhabricatorEdgeEditor()) - ->setActor($user) ->addEdge($phid1, PhabricatorEdgeConfig::TYPE_TEST_NO_CYCLE, $phid2) ->save(); $editor = id(new PhabricatorEdgeEditor()) - ->setActor($user) ->addEdge($phid2, PhabricatorEdgeConfig::TYPE_TEST_NO_CYCLE, $phid1); $caught = null; diff --git a/src/infrastructure/edges/constants/PhabricatorEdgeConfig.php b/src/infrastructure/edges/constants/PhabricatorEdgeConfig.php index d670107ccc..057af62689 100644 --- a/src/infrastructure/edges/constants/PhabricatorEdgeConfig.php +++ b/src/infrastructure/edges/constants/PhabricatorEdgeConfig.php @@ -5,9 +5,6 @@ final class PhabricatorEdgeConfig extends PhabricatorEdgeConstants { const TABLE_NAME_EDGE = 'edge'; const TABLE_NAME_EDGEDATA = 'edgedata'; - const TYPE_TASK_HAS_COMMIT = 1; - const TYPE_COMMIT_HAS_TASK = 2; - const TYPE_TASK_DEPENDS_ON_TASK = 3; const TYPE_TASK_DEPENDED_ON_BY_TASK = 4; @@ -19,9 +16,6 @@ final class PhabricatorEdgeConfig extends PhabricatorEdgeConstants { 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; @@ -63,9 +57,6 @@ final class PhabricatorEdgeConfig extends PhabricatorEdgeConstants { const TYPE_OBJECT_USES_CREDENTIAL = 39; const TYPE_CREDENTIAL_USED_BY_OBJECT = 40; - const TYPE_OBJECT_HAS_PROJECT = 41; - const TYPE_PROJECT_HAS_OBJECT = 42; - const TYPE_OBJECT_HAS_COLUMN = 43; const TYPE_COLUMN_HAS_OBJECT = 44; @@ -78,6 +69,13 @@ final class PhabricatorEdgeConfig extends PhabricatorEdgeConstants { const TYPE_OBJECT_NEEDS_SIGNATURE = 49; const TYPE_SIGNATURE_NEEDED_BY_OBJECT = 50; +/* !!!! STOP !!!! STOP !!!! STOP !!!! STOP !!!! STOP !!!! STOP !!!! STOP !!!! */ + + // HEY! DO NOT ADD NEW CONSTANTS HERE! + // Instead, subclass PhabricatorEdgeType. + +/* !!!! STOP !!!! STOP !!!! STOP !!!! STOP !!!! STOP !!!! STOP !!!! STOP !!!! */ + const TYPE_TEST_NO_CYCLE = 9000; const TYPE_PHOB_HAS_ASANATASK = 80001; @@ -89,11 +87,49 @@ final class PhabricatorEdgeConfig extends PhabricatorEdgeConstants { const TYPE_PHOB_HAS_JIRAISSUE = 80004; const TYPE_JIRAISSUE_HAS_PHOB = 80005; - public 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, + /** + * Build @{class:PhabricatorLegacyEdgeType} objects for edges which have not + * yet been modernized. This allows code to act as though we've completed + * the edge type migration before we actually do all the work, by building + * these fake type objects. + * + * @param list List of edge types that objects should not be built for. + * This is used to avoid constructing duplicate objects for edge constants + * which have migrated and already have a real object. + * @return list Real-looking edge type objects for + * unmigrated edge types. + */ + public static function getLegacyTypes(array $exclude) { + $consts = array_merge( + range(1, 50), + array(9000), + range(80000, 80005)); + $consts = array_diff($consts, $exclude); + + $map = array(); + foreach ($consts as $const) { + $prevent_cycles = self::shouldPreventCycles($const); + $inverse_constant = self::getInverse($const); + + $map[$const] = id(new PhabricatorLegacyEdgeType()) + ->setEdgeConstant($const) + ->setShouldPreventCycles($prevent_cycles) + ->setInverseEdgeConstant($inverse_constant) + ->setStrings( + array( + self::getAddStringForEdgeType($const), + self::getRemoveStringForEdgeType($const), + self::getEditStringForEdgeType($const), + self::getFeedStringForEdgeType($const), + )); + } + + return $map; + } + + private static function getInverse($edge_type) { + static $map = array( self::TYPE_TASK_DEPENDS_ON_TASK => self::TYPE_TASK_DEPENDED_ON_BY_TASK, self::TYPE_TASK_DEPENDED_ON_BY_TASK => self::TYPE_TASK_DEPENDS_ON_TASK, @@ -105,9 +141,6 @@ final class PhabricatorEdgeConfig extends PhabricatorEdgeConstants { 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, @@ -136,7 +169,7 @@ final class PhabricatorEdgeConfig extends PhabricatorEdgeConstants { self::TYPE_DREV_HAS_COMMIT => self::TYPE_COMMIT_HAS_DREV, self::TYPE_COMMIT_HAS_DREV => self::TYPE_DREV_HAS_COMMIT, - self::TYPE_OBJECT_HAS_CONTRIBUTOR => self::TYPE_SUBSCRIBED_TO_OBJECT, + self::TYPE_OBJECT_HAS_CONTRIBUTOR => self::TYPE_CONTRIBUTED_TO_OBJECT, self::TYPE_CONTRIBUTED_TO_OBJECT => self::TYPE_OBJECT_HAS_CONTRIBUTOR, self::TYPE_TASK_HAS_MOCK => self::TYPE_MOCK_HAS_TASK, @@ -157,9 +190,6 @@ final class PhabricatorEdgeConfig extends PhabricatorEdgeConstants { self::TYPE_OBJECT_USES_CREDENTIAL => self::TYPE_CREDENTIAL_USED_BY_OBJECT, self::TYPE_CREDENTIAL_USED_BY_OBJECT => self::TYPE_OBJECT_USES_CREDENTIAL, - self::TYPE_OBJECT_HAS_PROJECT => self::TYPE_PROJECT_HAS_OBJECT, - self::TYPE_PROJECT_HAS_OBJECT => self::TYPE_OBJECT_HAS_PROJECT, - self::TYPE_OBJECT_HAS_COLUMN => self::TYPE_COLUMN_HAS_OBJECT, self::TYPE_COLUMN_HAS_OBJECT => self::TYPE_OBJECT_HAS_COLUMN, @@ -178,7 +208,7 @@ final class PhabricatorEdgeConfig extends PhabricatorEdgeConstants { 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, @@ -217,19 +247,15 @@ final class PhabricatorEdgeConfig extends PhabricatorEdgeConstants { public static function getEditStringForEdgeType($type) { switch ($type) { - case self::TYPE_TASK_HAS_COMMIT: case self::TYPE_PROJECT_HAS_COMMIT: case self::TYPE_DREV_HAS_COMMIT: return '%s edited commit(s), added %d: %s; removed %d: %s.'; - 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.'; @@ -244,7 +270,6 @@ final class PhabricatorEdgeConfig extends PhabricatorEdgeConstants { return '%s edited member(s), added %d: %s; removed %d: %s.'; case self::TYPE_MEMBER_OF_PROJ: case self::TYPE_COMMIT_HAS_PROJECT: - case self::TYPE_OBJECT_HAS_PROJECT: return '%s edited project(s), added %d: %s; removed %d: %s.'; case self::TYPE_QUESTION_HAS_VOTING_USER: case self::TYPE_ANSWER_HAS_VOTING_USER: @@ -259,7 +284,6 @@ final class PhabricatorEdgeConfig extends PhabricatorEdgeConstants { case self::TYPE_UNSUBSCRIBED_FROM_OBJECT: case self::TYPE_FILE_HAS_OBJECT: case self::TYPE_CONTRIBUTED_TO_OBJECT: - case self::TYPE_PROJECT_HAS_OBJECT: return '%s edited object(s), added %d: %s; removed %d: %s.'; case self::TYPE_OBJECT_HAS_UNSUBSCRIBER: return '%s edited unsubcriber(s), added %d: %s; removed %d: %s.'; @@ -295,7 +319,6 @@ final class PhabricatorEdgeConfig extends PhabricatorEdgeConstants { public static function getAddStringForEdgeType($type) { switch ($type) { - case self::TYPE_TASK_HAS_COMMIT: case self::TYPE_PROJECT_HAS_COMMIT: case self::TYPE_DREV_HAS_COMMIT: return '%s added %d commit(s): %s.'; @@ -305,12 +328,9 @@ final class PhabricatorEdgeConfig extends PhabricatorEdgeConstants { return '%s added %d dependencie(s): %s.'; 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.'; @@ -325,7 +345,6 @@ final class PhabricatorEdgeConfig extends PhabricatorEdgeConstants { return '%s added %d member(s): %s.'; case self::TYPE_MEMBER_OF_PROJ: case self::TYPE_COMMIT_HAS_PROJECT: - case self::TYPE_OBJECT_HAS_PROJECT: return '%s added %d project(s): %s.'; case self::TYPE_QUESTION_HAS_VOTING_USER: case self::TYPE_ANSWER_HAS_VOTING_USER: @@ -366,7 +385,6 @@ final class PhabricatorEdgeConfig extends PhabricatorEdgeConstants { case self::TYPE_UNSUBSCRIBED_FROM_OBJECT: case self::TYPE_FILE_HAS_OBJECT: case self::TYPE_CONTRIBUTED_TO_OBJECT: - case self::TYPE_PROJECT_HAS_OBJECT: default: return '%s added %d object(s): %s.'; @@ -375,7 +393,6 @@ final class PhabricatorEdgeConfig extends PhabricatorEdgeConstants { public static function getRemoveStringForEdgeType($type) { switch ($type) { - case self::TYPE_TASK_HAS_COMMIT: case self::TYPE_PROJECT_HAS_COMMIT: case self::TYPE_DREV_HAS_COMMIT: return '%s removed %d commit(s): %s.'; @@ -383,13 +400,10 @@ final class PhabricatorEdgeConfig extends PhabricatorEdgeConstants { return '%s removed %d blocking task(s): %s.'; 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.'; @@ -404,7 +418,6 @@ final class PhabricatorEdgeConfig extends PhabricatorEdgeConstants { return '%s removed %d member(s): %s.'; case self::TYPE_MEMBER_OF_PROJ: case self::TYPE_COMMIT_HAS_PROJECT: - case self::TYPE_OBJECT_HAS_PROJECT: return '%s removed %d project(s): %s.'; case self::TYPE_QUESTION_HAS_VOTING_USER: case self::TYPE_ANSWER_HAS_VOTING_USER: @@ -443,7 +456,6 @@ final class PhabricatorEdgeConfig extends PhabricatorEdgeConstants { case self::TYPE_UNSUBSCRIBED_FROM_OBJECT: case self::TYPE_FILE_HAS_OBJECT: case self::TYPE_CONTRIBUTED_TO_OBJECT: - case self::TYPE_PROJECT_HAS_OBJECT: default: return '%s removed %d object(s): %s.'; @@ -452,19 +464,15 @@ final class PhabricatorEdgeConfig extends PhabricatorEdgeConstants { public static function getFeedStringForEdgeType($type) { switch ($type) { - case self::TYPE_TASK_HAS_COMMIT: case self::TYPE_PROJECT_HAS_COMMIT: case self::TYPE_DREV_HAS_COMMIT: return '%s updated commits of %s.'; - 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.'; @@ -479,7 +487,6 @@ final class PhabricatorEdgeConfig extends PhabricatorEdgeConstants { return '%s updated members of %s.'; case self::TYPE_MEMBER_OF_PROJ: case self::TYPE_COMMIT_HAS_PROJECT: - case self::TYPE_OBJECT_HAS_PROJECT: return '%s updated projects of %s.'; case self::TYPE_QUESTION_HAS_VOTING_USER: case self::TYPE_ANSWER_HAS_VOTING_USER: @@ -518,7 +525,6 @@ final class PhabricatorEdgeConfig extends PhabricatorEdgeConstants { case self::TYPE_UNSUBSCRIBED_FROM_OBJECT: case self::TYPE_FILE_HAS_OBJECT: case self::TYPE_CONTRIBUTED_TO_OBJECT: - case self::TYPE_PROJECT_HAS_OBJECT: default: return '%s updated objects of %s.'; diff --git a/src/infrastructure/edges/editor/PhabricatorEdgeEditor.php b/src/infrastructure/edges/editor/PhabricatorEdgeEditor.php index 7de1b43f3d..42909ee6e2 100644 --- a/src/infrastructure/edges/editor/PhabricatorEdgeEditor.php +++ b/src/infrastructure/edges/editor/PhabricatorEdgeEditor.php @@ -5,6 +5,9 @@ * @{class:PhabricatorEdgeQuery} to load object edges. For more information * on edges, see @{article:Using Edges}. * + * Edges are not directly policy aware, and this editor makes low-level changes + * below the policy layer. + * * name=Adding Edges * $src = $earth_phid; * $type = PhabricatorEdgeConfig::TYPE_BODY_HAS_SATELLITE; @@ -12,19 +15,17 @@ * * id(new PhabricatorEdgeEditor()) * ->addEdge($src, $type, $dst) - * ->setActor($user) * ->save(); * * @task edit Editing Edges * @task cycles Cycle Prevention * @task internal Internals */ -final class PhabricatorEdgeEditor extends PhabricatorEditor { +final class PhabricatorEdgeEditor extends Phobject { private $addEdges = array(); private $remEdges = array(); private $openTransactions = array(); - private $suppressEvents; /* -( Editing Edges )------------------------------------------------------ */ @@ -118,8 +119,6 @@ final class PhabricatorEdgeEditor extends PhabricatorEditor { static $id = 0; $id++; - $this->sendEvent($id, PhabricatorEventType::TYPE_EDGE_WILLEDITEDGES); - // NOTE: Removes first, then adds, so that "remove + add" is a useful // operation meaning "overwrite". @@ -130,8 +129,6 @@ final class PhabricatorEdgeEditor extends PhabricatorEditor { $this->detectCycles($src_phids, $cycle_type); } - $this->sendEvent($id, PhabricatorEventType::TYPE_EDGE_DIDEDITEDGES); - $this->saveTransactions(); } catch (Exception $ex) { $caught = $ex; @@ -180,8 +177,9 @@ final class PhabricatorEdgeEditor extends PhabricatorEditor { 'data' => $data, ); - $inverse = PhabricatorEdgeConfig::getInverse($type); - if ($inverse) { + $type_obj = PhabricatorEdgeType::getByConstant($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. @@ -350,37 +348,6 @@ final class PhabricatorEdgeEditor extends PhabricatorEditor { } } - /** - * Suppress edge edit events. This prevents listeners from making updates in - * response to edits, and is primarily useful when performing migrations. You - * should not normally need to use it. - * - * @param bool True to suppress events related to edits. - * @return this - * @task internal - */ - public function setSuppressEvents($suppress) { - $this->suppressEvents = $suppress; - return $this; - } - - - private function sendEvent($edit_id, $event_type) { - if ($this->suppressEvents) { - return; - } - - $event = new PhabricatorEvent( - $event_type, - array( - 'id' => $edit_id, - 'add' => $this->addEdges, - 'rem' => $this->remEdges, - )); - $event->setUser($this->getActor()); - PhutilEventEngine::dispatchEvent($event); - } - /* -( Cycle Prevention )--------------------------------------------------- */ @@ -398,7 +365,8 @@ final class PhabricatorEdgeEditor extends PhabricatorEditor { $edge_types[$edge['type']] = true; } foreach ($edge_types as $type => $ignored) { - if (!PhabricatorEdgeConfig::shouldPreventCycles($type)) { + $type_obj = PhabricatorEdgeType::getByConstant($type); + if (!$type_obj->shouldPreventCycles()) { unset($edge_types[$type]); } } diff --git a/src/infrastructure/edges/type/PhabricatorEdgeType.php b/src/infrastructure/edges/type/PhabricatorEdgeType.php new file mode 100644 index 0000000000..6c2f28e584 --- /dev/null +++ b/src/infrastructure/edges/type/PhabricatorEdgeType.php @@ -0,0 +1,234 @@ +getConstant('EDGECONST'); + if ($const === false) { + throw new Exception( + pht( + 'EdgeType class "%s" must define an EDGECONST property.', + get_class($this))); + } + + if (!is_int($const) || ($const <= 0)) { + throw new Exception( + pht( + 'EdgeType class "%s" has an invalid EDGECONST property. Edge '. + 'constants must be positive integers.', + get_class($this))); + } + + return $const; + } + + public function getInverseEdgeConstant() { + return null; + } + + public function shouldPreventCycles() { + return false; + } + + public function shouldWriteInverseTransactions() { + return false; + } + + public function getTransactionAddString( + $actor, + $add_count, + $add_edges) { + + return pht( + '%s added %s edge(s): %s.', + $actor, + $add_count, + $add_edges); + } + + public function getTransactionRemoveString( + $actor, + $rem_count, + $rem_edges) { + + return pht( + '%s removed %s edge(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 edge(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 edge(s) to %s: %s.', + $actor, + $add_count, + $object, + $add_edges); + } + + public function getFeedRemoveString( + $actor, + $object, + $rem_count, + $rem_edges) { + + return pht( + '%s removed %s edge(s) from %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 %s edge(s) for %s, added %s: %s; removed %s: %s.', + $actor, + $total_count, + $object, + $add_count, + $add_edges, + $rem_count, + $rem_edges); + } + + +/* -( Loading Types )------------------------------------------------------ */ + + + /** + * @task load + */ + public static function getAllTypes() { + static $type_map; + + if ($type_map === null) { + $types = id(new PhutilSymbolLoader()) + ->setAncestorClass(__CLASS__) + ->loadObjects(); + + $map = array(); + + + // TODO: Remove this once everything is migrated. + $exclude = mpull($types, 'getEdgeConstant'); + $map = PhabricatorEdgeConfig::getLegacyTypes($exclude); + unset($types['PhabricatorLegacyEdgeType']); + + + foreach ($types as $class => $type) { + $const = $type->getEdgeConstant(); + + if (isset($map[$const])) { + throw new Exception( + pht( + 'Two edge types ("%s", "%s") share the same edge constant '. + '(%d). Each edge type must have a unique constant.', + $class, + get_class($map[$const]), + $const)); + } + + $map[$const] = $type; + } + + // Check that all the inverse edge definitions actually make sense. If + // edge type A says B is its inverse, B must exist and say that A is its + // inverse. + + foreach ($map as $const => $type) { + $inverse = $type->getInverseEdgeConstant(); + if ($inverse === null) { + continue; + } + + if (empty($map[$inverse])) { + throw new Exception( + pht( + 'Edge type "%s" ("%d") defines an inverse type ("%d") which '. + 'does not exist.', + get_class($type), + $const, + $inverse)); + } + + $inverse_inverse = $map[$inverse]->getInverseEdgeConstant(); + if ($inverse_inverse !== $const) { + throw new Exception( + pht( + 'Edge type "%s" ("%d") defines an inverse type ("%d"), but that '. + 'inverse type defines a different type ("%d") as its '. + 'inverse.', + get_class($type), + $const, + $inverse, + $inverse_inverse)); + } + } + + $type_map = $map; + } + + return $type_map; + } + + + /** + * @task load + */ + public static function getByConstant($const) { + $type = idx(self::getAllTypes(), $const); + + if (!$type) { + throw new Exception( + pht('Unknown edge constant "%s"!', $const)); + } + + return $type; + } + +} diff --git a/src/infrastructure/edges/type/PhabricatorLegacyEdgeType.php b/src/infrastructure/edges/type/PhabricatorLegacyEdgeType.php new file mode 100644 index 0000000000..2147108acd --- /dev/null +++ b/src/infrastructure/edges/type/PhabricatorLegacyEdgeType.php @@ -0,0 +1,119 @@ +edgeConstant; + } + + public function getInverseEdgeConstant() { + return $this->inverseEdgeConstant; + } + + public function shouldPreventCycles() { + return $this->shouldPreventCycles; + } + + public function setEdgeConstant($edge_constant) { + $this->edgeConstant = $edge_constant; + return $this; + } + + public function setInverseEdgeConstant($inverse_edge_constant) { + $this->inverseEdgeConstant = $inverse_edge_constant; + return $this; + } + + public function setShouldPreventCycles($should_prevent_cycles) { + $this->shouldPreventCycles = $should_prevent_cycles; + return $this; + } + + public function setStrings(array $strings) { + $this->strings = $strings; + return $this; + } + + private function getString($idx, array $argv) { + array_unshift($argv, idx($this->strings, $idx, '')); + + // TODO: Burn this class in a fire. Just hiding this from lint for now. + $pht_func = 'pht'; + return call_user_func_array($pht_func, $argv); + } + + public function getTransactionAddString( + $actor, + $add_count, + $add_edges) { + + $args = func_get_args(); + return $this->getString(0, $args); + } + + public function getTransactionRemoveString( + $actor, + $rem_count, + $rem_edges) { + + $args = func_get_args(); + return $this->getString(1, $args); + } + + public function getTransactionEditString( + $actor, + $total_count, + $add_count, + $add_edges, + $rem_count, + $rem_edges) { + + $args = func_get_args(); + return $this->getString(2, $args); + } + + public function getFeedAddString( + $actor, + $object, + $add_count, + $add_edges) { + + $args = func_get_args(); + return $this->getString(3, $args); + } + + public function getFeedRemoveString( + $actor, + $object, + $rem_count, + $rem_edges) { + + $args = func_get_args(); + return $this->getString(3, $args); + } + + public function getFeedEditString( + $actor, + $object, + $total_count, + $add_count, + $add_edges, + $rem_count, + $rem_edges) { + + $args = func_get_args(); + return $this->getString(3, $args); + } + +} diff --git a/src/infrastructure/events/PhabricatorEventEngine.php b/src/infrastructure/events/PhabricatorEventEngine.php index 9959efe664..67807317c6 100644 --- a/src/infrastructure/events/PhabricatorEventEngine.php +++ b/src/infrastructure/events/PhabricatorEventEngine.php @@ -25,7 +25,6 @@ final class PhabricatorEventEngine { // Add builtin listeners. $listeners[] = new DarkConsoleEventPluginAPI(); - $listeners[] = new ManiphestEdgeEventListener(); // Add application listeners. $applications = PhabricatorApplication::getAllInstalledApplications(); diff --git a/src/infrastructure/events/constant/PhabricatorEventType.php b/src/infrastructure/events/constant/PhabricatorEventType.php index f33cd4a2d4..a7de9465e2 100644 --- a/src/infrastructure/events/constant/PhabricatorEventType.php +++ b/src/infrastructure/events/constant/PhabricatorEventType.php @@ -16,9 +16,6 @@ final class PhabricatorEventType extends PhutilEventType { const TYPE_DIFFUSION_DIDDISCOVERCOMMIT = 'diffusion.didDiscoverCommit'; const TYPE_DIFFUSION_LOOKUPUSER = 'diffusion.lookupUser'; - const TYPE_EDGE_WILLEDITEDGES = 'edge.willEditEdges'; - const TYPE_EDGE_DIDEDITEDGES = 'edge.didEditEdges'; - const TYPE_TEST_DIDRUNTEST = 'test.didRunTest'; const TYPE_UI_DIDRENDERACTIONS = 'ui.didRenderActions'; diff --git a/src/infrastructure/internationalization/translation/PhabricatorBaseEnglishTranslation.php b/src/infrastructure/internationalization/translation/PhabricatorBaseEnglishTranslation.php index 338eadc068..d0888d496e 100644 --- a/src/infrastructure/internationalization/translation/PhabricatorBaseEnglishTranslation.php +++ b/src/infrastructure/internationalization/translation/PhabricatorBaseEnglishTranslation.php @@ -936,7 +936,143 @@ abstract class PhabricatorBaseEnglishTranslation '%s updated JIRA issue(s): added %d %s; removed %d %s.' => '%s updated JIRA issues: added %3$s; removed %5$s.', + '%s added %s task(s): %s.' => array( + array( + '%s added a task: %3$s.', + '%s added tasks: %3$s.', + ), + ), + + '%s removed %s task(s): %s.' => array( + array( + '%s removed a task: %3$s.', + '%s removed tasks: %3$s.', + ), + ), + + '%s edited %s task(s), added %s: %s; removed %s: %s.' => + '%s edited tasks, added %4$s; removed %6$s.', + + '%s added %s task(s) to %s: %s.' => array( + array( + '%s added a task to %3$s: %4$s.', + '%s added tasks to %3$s: %4$s.', + ), + ), + + '%s removed %s task(s) from %s: %s.' => array( + array( + '%s removed a task from %3$s: %4$s.', + '%s removed tasks from %3$s: %4$s.', + ), + ), + + '%s edited %s task(s) for %s, added %s: %s; removed %s: %s.' => + '%s edited tasks for %3$s, added: %5$s; removed %7$s.', + + '%s added %s commit(s): %s.' => array( + array( + '%s added a commit: %3$s.', + '%s added commits: %3$s.', + ), + ), + + '%s removed %s commit(s): %s.' => array( + array( + '%s removed a commit: %3$s.', + '%s removed commits: %3$s.', + ), + ), + + '%s edited %s commit(s), added %s: %s; removed %s: %s.' => + '%s edited commits, added %4$s; removed %6$s.', + + '%s added %s commit(s) to %s: %s.' => array( + array( + '%s added a commit to %3$s: %4$s.', + '%s added commits to %3$s: %4$s.', + ), + ), + + '%s removed %s commit(s) from %s: %s.' => array( + array( + '%s removed a commit from %3$s: %4$s.', + '%s removed commits from %3$s: %4$s.', + ), + ), + + '%s edited %s commit(s) for %s, added %s: %s; removed %s: %s.' => + '%s edited commits for %3$s, added: %5$s; removed %7$s.', + + '%s added %s revision(s): %s.' => array( + array( + '%s added a revision: %3$s.', + '%s added revisionss: %3$s.', + ), + ), + + '%s removed %s revision(s): %s.' => array( + array( + '%s removed a revision: %3$s.', + '%s removed revisions: %3$s.', + ), + ), + + '%s edited %s revision(s), added %s: %s; removed %s: %s.' => + '%s edited revisions, added %4$s; removed %6$s.', + + '%s added %s revision(s) to %s: %s.' => array( + array( + '%s added a revision to %3$s: %4$s.', + '%s added revisions to %3$s: %4$s.', + ), + ), + + '%s removed %s revision(s) from %s: %s.' => array( + array( + '%s removed a revision from %3$s: %4$s.', + '%s removed revisions from %3$s: %4$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 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 projects, added %4$s; removed %6$s.', + + '%s added %s project(s) to %s: %s.' => array( + array( + '%s added a project to %3$s: %4$s.', + '%s added projects to %3$s: %4$s.', + ), + ), + + '%s removed %s project(s) from %s: %s.' => array( + array( + '%s removed a project from %3$s: %4$s.', + '%s removed projects from %3$s: %4$s.', + ), + ), + + '%s edited %s project(s) for %s, added %s: %s; removed %s: %s.' => + '%s edited projects for %3$s, added: %5$s; removed %7$s.', + ); } - } +} diff --git a/src/infrastructure/markup/PhabricatorMarkupEngine.php b/src/infrastructure/markup/PhabricatorMarkupEngine.php index df7fa0c887..aa89e6ea07 100644 --- a/src/infrastructure/markup/PhabricatorMarkupEngine.php +++ b/src/infrastructure/markup/PhabricatorMarkupEngine.php @@ -41,7 +41,7 @@ final class PhabricatorMarkupEngine { private $objects = array(); private $viewer; - private $version = 12; + private $version = 13; /* -( Markup Pipeline )---------------------------------------------------- */ diff --git a/src/infrastructure/storage/lisk/LiskDAO.php b/src/infrastructure/storage/lisk/LiskDAO.php index 3683e35e6f..b3f54d0817 100644 --- a/src/infrastructure/storage/lisk/LiskDAO.php +++ b/src/infrastructure/storage/lisk/LiskDAO.php @@ -168,7 +168,6 @@ abstract class LiskDAO { const CONFIG_TIMESTAMPS = 'timestamps'; const CONFIG_AUX_PHID = 'auxiliary-phid'; const CONFIG_SERIALIZATION = 'col-serialization'; - const CONFIG_PARTIAL_OBJECTS = 'partial-objects'; const CONFIG_BINARY = 'binary'; const SERIALIZATION_NONE = 'id'; @@ -181,8 +180,6 @@ abstract class LiskDAO { const COUNTER_TABLE_NAME = 'lisk_counter'; - private $dirtyFields = array(); - private $missingFields = array(); private static $processIsolationLevel = 0; private static $transactionIsolationLevel = 0; @@ -207,10 +204,6 @@ abstract class LiskDAO { if ($id_key) { $this->$id_key = null; } - - if ($this->getConfigOption(self::CONFIG_PARTIAL_OBJECTS)) { - $this->resetDirtyFields(); - } } @@ -345,16 +338,6 @@ abstract class LiskDAO { * This will cause Lisk to JSON-serialize the 'complex' field before it is * written, and unserialize it when it is read. * - * CONFIG_PARTIAL_OBJECTS - * Sometimes, it is useful to load only some fields of an object (such as - * when you are loading all objects of a class, but only care about a few - * fields). Turning on this option (by setting it to a truthy value) allows - * users of the class to create/use partial objects, but it comes with some - * side effects: your class cannot override the setters and getters provided - * by Lisk (use readField and writeField instead), and you should not - * directly access or assign protected members of your class (use the getters - * and setters). - * * CONFIG_BINARY * You can optionally provide a map of columns to a flag indicating that * they store binary data. These columns will not raise an error when @@ -368,7 +351,6 @@ abstract class LiskDAO { return array( self::CONFIG_IDS => self::IDS_AUTOINCREMENT, self::CONFIG_TIMESTAMPS => true, - self::CONFIG_PARTIAL_OBJECTS => false, ); } @@ -435,18 +417,6 @@ abstract class LiskDAO { return $this->loadAllWhere('1 = 1'); } - /** - * Loads all objects, but only fetches the specified columns. - * - * @param array Array of canonical column names as strings - * @return dict Dictionary of all objects, keyed by ID. - * - * @task load - */ - public function loadColumns(array $columns) { - return $this->loadColumnsWhere($columns, '1 = 1'); - } - /** * Load all objects which match a WHERE clause. You provide everything after @@ -463,30 +433,6 @@ abstract class LiskDAO { * @task load */ public function loadAllWhere($pattern /* , $arg, $arg, $arg ... */) { - $args = func_get_args(); - array_unshift($args, null); - $data = call_user_func_array( - array($this, 'loadRawDataWhere'), - $args); - return $this->loadAllFromArray($data); - } - - /** - * Loads selected columns from objects that match a WHERE clause. You must - * provide everything after the WHERE. See loadAllWhere(). - * - * @param array List of column names. - * @param string queryfx()-style SQL WHERE clause. - * @param ... Zero or more conversions. - * @return dict Dictionary of matching objecks, keyed by ID. - * - * @task load - */ - public function loadColumnsWhere(array $columns, $pattern /* , $args... */) { - if (!$this->getConfigOption(self::CONFIG_PARTIAL_OBJECTS)) { - throw new BadMethodCallException( - 'This class does not support partial objects.'); - } $args = func_get_args(); $data = call_user_func_array( array($this, 'loadRawDataWhere'), @@ -509,7 +455,6 @@ abstract class LiskDAO { */ public function loadOneWhere($pattern /* , $arg, $arg, $arg ... */) { $args = func_get_args(); - array_unshift($args, null); $data = call_user_func_array( array($this, 'loadRawDataWhere'), $args); @@ -528,7 +473,7 @@ abstract class LiskDAO { } - protected function loadRawDataWhere($columns, $pattern /* , $args... */) { + protected function loadRawDataWhere($pattern /* , $args... */) { $connection = $this->establishConnection('r'); $lock_clause = ''; @@ -539,25 +484,10 @@ abstract class LiskDAO { } $args = func_get_args(); - $args = array_slice($args, 2); + $args = array_slice($args, 1); - if (!$columns) { - $column = '*'; - } else { - $column = '%LC'; - $columns[] = $this->getIDKey(); - - $properties = $this->getProperties(); - $this->missingFields = array_diff_key( - array_flip($properties), - array_flip($columns)); - } - - $pattern = 'SELECT '.$column.' FROM %T WHERE '.$pattern.' %Q'; + $pattern = 'SELECT * FROM %T WHERE '.$pattern.' %Q'; array_unshift($args, $this->getTableName()); - if ($columns) { - array_unshift($args, $columns); - } array_push($args, $lock_clause); array_unshift($args, $pattern); @@ -1141,9 +1071,6 @@ abstract class LiskDAO { $this->willSaveObject(); $data = $this->getPropertyValues(); - if ($this->getConfigOption(self::CONFIG_PARTIAL_OBJECTS)) { - $data = array_intersect_key($data, $this->dirtyFields); - } $this->willWriteData($data); $map = array(); @@ -1176,10 +1103,6 @@ abstract class LiskDAO { $this->didWriteData(); - if ($this->getConfigOption(self::CONFIG_PARTIAL_OBJECTS)) { - $this->resetDirtyFields(); - } - return $this; } @@ -1286,10 +1209,6 @@ abstract class LiskDAO { $this->didWriteData(); - if ($this->getConfigOption(self::CONFIG_PARTIAL_OBJECTS)) { - $this->resetDirtyFields(); - } - return $this; } @@ -1680,20 +1599,6 @@ abstract class LiskDAO { } } - /** - * Resets the dirty fields (fields which need to be written on next save/ - * update/insert/replace). If this DAO has timestamps, the modified time - * is always a dirty field. - * - * @task util - */ - private function resetDirtyFields() { - $this->dirtyFields = array(); - if ($this->getConfigOption(self::CONFIG_TIMESTAMPS)) { - $this->dirtyFields['dateModified'] = true; - } - } - /** * Black magic. Builds implied get*() and set*() for all properties. * @@ -1719,10 +1624,6 @@ abstract class LiskDAO { // optimizations. static $dispatch_map = array(); - static $partial = null; - if ($partial === null) { - $partial = $this->getConfigOption(self::CONFIG_PARTIAL_OBJECTS); - } if ($method[0] === 'g') { if (isset($dispatch_map[$method])) { @@ -1738,10 +1639,6 @@ abstract class LiskDAO { $dispatch_map[$method] = $property; } - if ($partial && isset($this->missingFields[$property])) { - throw new Exception("Cannot get field that wasn't loaded: {$property}"); - } - return $this->readField($property); } @@ -1759,11 +1656,6 @@ abstract class LiskDAO { } $dispatch_map[$method] = $property; } - if ($partial) { - // Accept writes to fields that weren't initially loaded - unset($this->missingFields[$property]); - $this->dirtyFields[$property] = true; - } $this->writeField($property, $args[0]); diff --git a/src/view/form/control/AphrontFormTokenizerControl.php b/src/view/form/control/AphrontFormTokenizerControl.php index ff82986a99..24409293f5 100644 --- a/src/view/form/control/AphrontFormTokenizerControl.php +++ b/src/view/form/control/AphrontFormTokenizerControl.php @@ -7,7 +7,7 @@ final class AphrontFormTokenizerControl extends AphrontFormControl { private $limit; private $placeholder; - public function setDatasource($datasource) { + public function setDatasource(PhabricatorTypeaheadDatasource $datasource) { $this->datasource = $datasource; return $this; } @@ -43,8 +43,11 @@ final class AphrontFormTokenizerControl extends AphrontFormControl { $id = celerity_generate_unique_node_id(); } + $placeholder = null; if (!strlen($this->placeholder)) { - $placeholder = $this->getDefaultPlaceholder(); + if ($this->datasource) { + $placeholder = $this->datasource->getPlaceholderText(); + } } else { $placeholder = $this->placeholder; } @@ -59,10 +62,9 @@ final class AphrontFormTokenizerControl extends AphrontFormControl { $username = $this->user->getUsername(); } - if ($this->datasource instanceof PhabricatorTypeaheadDatasource) { + $datasource_uri = null; + if ($this->datasource) { $datasource_uri = $this->datasource->getDatasourceURI(); - } else { - $datasource_uri = $this->datasource; } if (!$this->disableBehavior) { @@ -80,41 +82,4 @@ final class AphrontFormTokenizerControl extends AphrontFormControl { return $template->render(); } - private function getDefaultPlaceholder() { - $datasource = $this->datasource; - - if ($datasource instanceof PhabricatorTypeaheadDatasource) { - return $datasource->getPlaceholderText(); - } - - $matches = null; - if (!preg_match('@^/typeahead/common/(.*)/$@', $datasource, $matches)) { - return null; - } - - $request = $matches[1]; - - $map = array( - 'users' => pht('Type a user name...'), - 'authors' => pht('Type a user name...'), - 'usersorprojects' => pht('Type a user or project name...'), - 'searchowner' => pht('Type a user name...'), - 'accounts' => pht('Type a user name...'), - 'mailable' => pht('Type a user, project, or mailing list...'), - 'allmailable' => pht('Type a user, project, or mailing list...'), - 'searchproject' => pht('Type a project name...'), - 'projects' => pht('Type a project name...'), - 'repositories' => pht('Type a repository name...'), - 'packages' => pht('Type a package name...'), - 'macros' => pht('Type a macro name...'), - 'arcanistproject' => pht('Type an arc project name...'), - 'accountsorprojects' => pht('Type a user or project name...'), - 'usersprojectsorpackages' => - pht('Type a user, project, or package name...'), - ); - - return idx($map, $request); - } - - } diff --git a/src/view/page/menu/PhabricatorMainMenuSearchView.php b/src/view/page/menu/PhabricatorMainMenuSearchView.php index 3c4b677c9f..9c8058c81e 100644 --- a/src/view/page/menu/PhabricatorMainMenuSearchView.php +++ b/src/view/page/menu/PhabricatorMainMenuSearchView.php @@ -35,13 +35,15 @@ final class PhabricatorMainMenuSearchView extends AphrontView { ), ''); + $search_datasource = new PhabricatorSearchDatasource(); + Javelin::initBehavior( 'phabricator-search-typeahead', array( 'id' => $target_id, 'input' => $search_id, 'button' => $button_id, - 'src' => '/typeahead/common/mainsearch/', + 'src' => $search_datasource->getDatasourceURI(), 'limit' => 10, 'placeholder' => pht('Search'), )); diff --git a/support/aphlict/server/aphlict_server.js b/support/aphlict/server/aphlict_server.js index d2594c720e..f6dd53dbf9 100644 --- a/support/aphlict/server/aphlict_server.js +++ b/support/aphlict/server/aphlict_server.js @@ -163,29 +163,48 @@ var start_time = new Date().getTime(); var receive_server = http.createServer(function(request, response) { // Publishing a notification. - if (request.method == 'POST') { - var body = ''; + if (request.url == '/') { + if (request.method == 'POST') { + var body = ''; - request.on('data', function(data) { - body += data; - }); + request.on('data', function(data) { + body += data; + }); - request.on('end', function() { - try { - var msg = JSON.parse(body); + request.on('end', function() { + try { + var msg = JSON.parse(body); - debug.log('notification: ' + JSON.stringify(msg)); - ++messages_in; - transmit(msg); + debug.log('notification: ' + JSON.stringify(msg)); + ++messages_in; - response.writeHead(200, {'Content-Type': 'text/plain'}); - } catch (err) { - response.statusCode = 400; - response.write('400 Bad Request'); - } finally { - response.end(); - } - }); + try { + transmit(msg); + response.writeHead(200, {'Content-Type': 'text/plain'}); + } catch (err) { + debug.log( + '<%s> Internal Server Error! %s', + request.socket.remoteAddress, + err); + response.statusCode = 500; + response.write('500 Internal Server Error\n'); + } + } catch (err) { + debug.log( + '<%s> Bad Request! %s', + request.socket.remoteAddress, + err); + response.statusCode = 400; + response.write('400 Bad Request\n'); + } finally { + response.end(); + } + }); + } else { + response.statusCode = 405; + response.write('405 Method Not Allowed\n'); + response.end(); + } } else if (request.url == '/status/') { request.on('data', function() { // We just ignore the request data, but newer versions of Node don't @@ -208,8 +227,8 @@ var receive_server = http.createServer(function(request, response) { response.end(); }); } else { - response.statusCode = 400; - response.write('400 Bad Request'); + response.statusCode = 404; + response.write('404 Not Found\n'); response.end(); } }).listen(config.admin, config.host); diff --git a/webroot/rsrc/externals/javelin/lib/control/typeahead/Typeahead.js b/webroot/rsrc/externals/javelin/lib/control/typeahead/Typeahead.js index 5d558efc2b..d8f8aa27bf 100644 --- a/webroot/rsrc/externals/javelin/lib/control/typeahead/Typeahead.js +++ b/webroot/rsrc/externals/javelin/lib/control/typeahead/Typeahead.js @@ -241,6 +241,15 @@ JX.install('Typeahead', { var obj = {show: results}; var e = this.invoke('show', obj); + // If the user has an element focused, store the value before we redraw. + // After we redraw, try to select the same element if it still exists in + // the list. This prevents redraws from disrupting keyboard element + // selection. + var old_focus = null; + if (this._focus >= 0 && this._display[this._focus]) { + old_focus = this._display[this._focus].name; + } + // Note that the results list may have been update by the "show" event // listener. Non-result node (e.g. divider or label) may have been // inserted. @@ -256,6 +265,18 @@ JX.install('Typeahead', { this._hardpoint.appendChild(this._root); } JX.DOM.show(this._root); + + // If we had a node focused before, look for a node with the same value + // and focus it. + if (old_focus !== null) { + for (var ii = 0; ii < this._display.length; ii++) { + if (this._display[ii].name == old_focus) { + this._focus = ii; + this._drawFocus(); + break; + } + } + } } else { this.hide(); JX.DOM.setContent(this._root, null); diff --git a/webroot/rsrc/js/application/herald/HeraldRuleEditor.js b/webroot/rsrc/js/application/herald/HeraldRuleEditor.js index 4bfe502af6..f9da34e0f6 100644 --- a/webroot/rsrc/js/application/herald/HeraldRuleEditor.js +++ b/webroot/rsrc/js/application/herald/HeraldRuleEditor.js @@ -283,7 +283,8 @@ JX.install('HeraldRuleEditor', { var tokenizerConfig = { root : template, - src : this._config.template.source[type], + src : this._config.template.source[type].uri, + placeholder: this._config.template.source[type].placeholder, icons : this._config.template.icons, username : this._config.username }; diff --git a/webroot/rsrc/js/application/policy/behavior-policy-rule-editor.js b/webroot/rsrc/js/application/policy/behavior-policy-rule-editor.js index 94986df2f3..3da2cdad5c 100644 --- a/webroot/rsrc/js/application/policy/behavior-policy-rule-editor.js +++ b/webroot/rsrc/js/application/policy/behavior-policy-rule-editor.js @@ -5,9 +5,6 @@ * javelin-dom * javelin-util * phabricator-prefab - * javelin-tokenizer - * javelin-typeahead - * javelin-typeahead-preloaded-source * javelin-json */ JX.behavior('policy-rule-editor', function(config) { @@ -124,15 +121,14 @@ JX.behavior('policy-rule-editor', function(config) { node = JX.$H(template.markup).getNode(); node.id = ''; - var datasource = new JX.TypeaheadPreloadedSource(template.uri); + var options = { + root: node, + src: template.uri, + placeholder: template.placeholder, + limit: template.limit + }; - var typeahead = new JX.Typeahead(node); - typeahead.setDatasource(datasource); - - var tokenizer = new JX.Tokenizer(node); - tokenizer.setLimit(template.limit); - tokenizer.setTypeahead(typeahead); - tokenizer.setPlaceholder(template.placeholder); + var tokenizer = JX.Prefab.buildTokenizer(options).tokenizer; tokenizer.start(); get_fn = function() { return JX.keys(tokenizer.getTokens()); }; diff --git a/webroot/rsrc/js/core/Prefab.js b/webroot/rsrc/js/core/Prefab.js index f4e0bead01..0cf2b5b8b3 100644 --- a/webroot/rsrc/js/core/Prefab.js +++ b/webroot/rsrc/js/core/Prefab.js @@ -31,6 +31,7 @@ JX.install('Prefab', { return select; }, + /** * Build a Phabricator tokenizer out of a configuration with application * sorting, datasource and placeholder rules. @@ -142,82 +143,9 @@ JX.install('Prefab', { }); }; - var render_icon = function(icon) { - return JX.$N( - 'span', - {className: 'phui-icon-view phui-font-fa ' + icon}); - }; - datasource.setSortHandler(JX.bind(datasource, sort_handler)); - - // Don't show any closed objects until the query is specific enough that - // it only selects closed objects. Specifically, if the result list had - // any open objects, remove all the closed objects from the list. - var filter_handler = function(value, list) { - // Look for any open result. - var has_open = false; - var ii; - for (ii = 0; ii < list.length; ii++) { - if (!list[ii].closed) { - has_open = true; - break; - } - } - - if (!has_open) { - // Everything is closed, so just use it as-is. - return list; - } - - // Otherwise, only display the open results. - var results = []; - for (ii = 0; ii < list.length; ii++) { - if (!list[ii].closed) { - results.push(list[ii]); - } - } - - return results; - }; - - datasource.setFilterHandler(filter_handler); - - datasource.setTransformer( - function(object) { - var closed = object[9]; - var closed_ui; - if (closed) { - closed_ui = JX.$N( - 'div', - {className: 'tokenizer-closed'}, - closed); - } - - var icon = object[8]; - var icon_ui; - if (icon) { - icon_ui = render_icon(icon); - } - - var display = JX.$N( - 'div', - {className: 'tokenizer-result'}, - [icon_ui, object[0], closed_ui]); - if (closed) { - JX.DOM.alterClass(display, 'tokenizer-result-closed', true); - } - - return { - name: object[0], - display: display, - uri: object[1], - id: object[2], - priority: object[3], - priorityType: object[7], - icon: icon, - closed: closed - }; - }); + datasource.setFilterHandler(JX.Prefab.filterClosedResults); + datasource.setTransformer(JX.Prefab.transformDatasourceResults); var typeahead = new JX.Typeahead( root, @@ -227,19 +155,20 @@ JX.install('Prefab', { var tokenizer = new JX.Tokenizer(root); tokenizer.setTypeahead(typeahead); tokenizer.setRenderTokenCallback(function(value, key) { - var icon = datasource.getResult(key); - if (icon) { - icon = icon.icon; + var result = datasource.getResult(key); + + var icon; + if (result) { + icon = result.icon; + value = result.displayName; } else { icon = config.icons[key]; } - if (!icon) { - return value; + if (icon) { + icon = JX.Prefab._renderIcon(icon); } - icon = render_icon(icon); - // TODO: Maybe we should render these closed tags in grey? Figure out // how we're going to use color. @@ -263,7 +192,89 @@ JX.install('Prefab', { return { tokenizer: tokenizer }; + }, + + /** + * Filter callback for tokenizers and typeaheads which filters out closed + * or disabled objects unless they are the only options. + */ + filterClosedResults: function(value, list) { + // Look for any open result. + var has_open = false; + var ii; + for (ii = 0; ii < list.length; ii++) { + if (!list[ii].closed) { + has_open = true; + break; + } + } + + if (!has_open) { + // Everything is closed, so just use it as-is. + return list; + } + + // Otherwise, only display the open results. + var results = []; + for (ii = 0; ii < list.length; ii++) { + if (!list[ii].closed) { + results.push(list[ii]); + } + } + + return results; + }, + + /** + * Transform results from a wire format into a usable format in a standard + * way. + */ + transformDatasourceResults: function(fields) { + var closed = fields[9]; + var closed_ui; + if (closed) { + closed_ui = JX.$N( + 'div', + {className: 'tokenizer-closed'}, + closed); + } + + var icon = fields[8]; + var icon_ui; + if (icon) { + icon_ui = JX.Prefab._renderIcon(icon); + } + + var display = JX.$N( + 'div', + {className: 'tokenizer-result'}, + [icon_ui, fields[4] || fields[0], closed_ui]); + if (closed) { + JX.DOM.alterClass(display, 'tokenizer-result-closed', true); + } + + return { + name: fields[0], + displayName: fields[4] || fields[0], + display: display, + uri: fields[1], + id: fields[2], + priority: fields[3], + priorityType: fields[7], + imageURI: fields[6], + icon: icon, + closed: closed, + type: fields[5], + sprite: fields[10] + }; + }, + + _renderIcon: function(icon) { + return JX.$N( + 'span', + {className: 'phui-icon-view phui-font-fa ' + icon}); } + } }); diff --git a/webroot/rsrc/js/core/behavior-search-typeahead.js b/webroot/rsrc/js/core/behavior-search-typeahead.js index 79b2401ff5..151f938195 100644 --- a/webroot/rsrc/js/core/behavior-search-typeahead.js +++ b/webroot/rsrc/js/core/behavior-search-typeahead.js @@ -7,6 +7,7 @@ * javelin-uri * javelin-util * javelin-stratcom + * phabricator-prefab */ JX.behavior('phabricator-search-typeahead', function(config) { @@ -14,31 +15,28 @@ JX.behavior('phabricator-search-typeahead', function(config) { var datasource = new JX.TypeaheadOnDemandSource(config.src); function transform(object) { + object = JX.Prefab.transformDatasourceResults(object); + var attr = { className: 'phabricator-main-search-typeahead-result' }; - if (object[6]) { - attr.style = {backgroundImage: 'url('+object[6]+')'}; + if (object.imageURI) { + attr.style = {backgroundImage: 'url('+object.imageURI+')'}; } var render = JX.$N( 'span', attr, [ - JX.$N('span', {className: object[10]}), - JX.$N('span', {className: 'result-name'}, object[4] || object[0]), - JX.$N('span', {className: 'result-type'}, object[5]) + JX.$N('span', {className: object.sprite}), + JX.$N('span', {className: 'result-name'}, object.displayName), + JX.$N('span', {className: 'result-type'}, object.type) ]); - return { - name: object[0], - display: render, - uri: object[1], - id: object[2], - priority: object[3], - type: object[7] - }; + object.display = render; + + return object; } datasource.setTransformer(transform); @@ -76,8 +74,8 @@ JX.behavior('phabricator-search-typeahead', function(config) { } list.sort(function(u, v) { - var u_type = type_priority[u.type] || 999; - var v_type = type_priority[v.type] || 999; + var u_type = type_priority[u.priorityType] || 999; + var v_type = type_priority[v.priorityType] || 999; if (u_type != v_type) { return u_type - v_type; @@ -120,6 +118,7 @@ JX.behavior('phabricator-search-typeahead', function(config) { }; datasource.setSortHandler(JX.bind(datasource, sort_handler)); + datasource.setFilterHandler(JX.Prefab.filterClosedResults); datasource.setMaximumResultCount(config.limit); var typeahead = new JX.Typeahead(JX.$(config.id), JX.$(config.input));