diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index d499bfb27a..9bedd47770 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -944,6 +944,7 @@ phutil_register_library_map(array( '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', @@ -3724,6 +3725,7 @@ phutil_register_library_map(array( 'ManiphestTaskMailReceiver' => 'PhabricatorObjectMailReceiver', 'ManiphestTaskOwner' => 'ManiphestConstants', 'ManiphestTaskPriority' => 'ManiphestConstants', + 'ManiphestTaskPriorityDatasource' => 'PhabricatorTypeaheadDatasource', 'ManiphestTaskProject' => 'ManiphestDAO', 'ManiphestTaskQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', 'ManiphestTaskResultListView' => 'ManiphestView', diff --git a/src/applications/herald/controller/HeraldRuleController.php b/src/applications/herald/controller/HeraldRuleController.php index ae184ab1f3..a7eff04027 100644 --- a/src/applications/herald/controller/HeraldRuleController.php +++ b/src/applications/herald/controller/HeraldRuleController.php @@ -591,6 +591,7 @@ final class HeraldRuleController extends HeraldController { $sources = array( 'repository' => new DiffusionRepositoryDatasource(), 'legaldocuments' => new LegalpadDocumentDatasource(), + 'taskpriority' => new ManiphestTaskPriorityDatasource(), ); $sources = mpull($sources, 'getDatasourceURI'); @@ -601,7 +602,6 @@ final class HeraldRuleController extends HeraldController { 'project' => '/typeahead/common/projects/', 'userorproject' => '/typeahead/common/accountsorprojects/', 'buildplan' => '/typeahead/common/buildplans/', - 'taskpriority' => '/typeahead/common/taskpriority/', 'arcanistprojects' => '/typeahead/common/arcanistprojects/', ); diff --git a/src/applications/maniphest/typeahead/ManiphestTaskPriorityDatasource.php b/src/applications/maniphest/typeahead/ManiphestTaskPriorityDatasource.php new file mode 100644 index 0000000000..a6adc0a904 --- /dev/null +++ b/src/applications/maniphest/typeahead/ManiphestTaskPriorityDatasource.php @@ -0,0 +1,31 @@ +getViewer(); + $raw_query = $this->getRawQuery(); + + $results = array(); + + $priority_map = ManiphestTaskPriority::getTaskPriorityMap(); + foreach ($priority_map as $value => $name) { + // NOTE: $value is not a phid but is unique. This'll work. + $results[] = id(new PhabricatorTypeaheadResult()) + ->setPHID($value) + ->setName($name); + } + + return $results; + } + +} diff --git a/src/applications/typeahead/controller/PhabricatorTypeaheadCommonDatasourceController.php b/src/applications/typeahead/controller/PhabricatorTypeaheadCommonDatasourceController.php index aa6512f547..47c3fcc26e 100644 --- a/src/applications/typeahead/controller/PhabricatorTypeaheadCommonDatasourceController.php +++ b/src/applications/typeahead/controller/PhabricatorTypeaheadCommonDatasourceController.php @@ -33,7 +33,6 @@ final class PhabricatorTypeaheadCommonDatasourceController $need_symbols = false; $need_jump_objects = false; $need_build_plans = false; - $need_task_priority = false; switch ($this->type) { case 'mainsearch': $need_users = true; @@ -84,9 +83,6 @@ final class PhabricatorTypeaheadCommonDatasourceController case 'buildplans': $need_build_plans = true; break; - case 'taskpriority': - $need_task_priority = true; - break; } $results = array(); @@ -225,16 +221,6 @@ final class PhabricatorTypeaheadCommonDatasourceController } } - if ($need_task_priority) { - $priority_map = ManiphestTaskPriority::getTaskPriorityMap(); - foreach ($priority_map as $value => $name) { - // NOTE: $value is not a phid but is unique. This'll work. - $results[] = id(new PhabricatorTypeaheadResult()) - ->setPHID($value) - ->setName($name); - } - } - if ($need_projs) { $projs = id(new PhabricatorProjectQuery()) ->setViewer($viewer)