Page MenuHomePhabricator

D9877.id23716.diff
No OneTemporary

D9877.id23716.diff

diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -944,6 +944,7 @@
'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 @@
'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
--- a/src/applications/herald/controller/HeraldRuleController.php
+++ b/src/applications/herald/controller/HeraldRuleController.php
@@ -591,6 +591,7 @@
$sources = array(
'repository' => new DiffusionRepositoryDatasource(),
'legaldocuments' => new LegalpadDocumentDatasource(),
+ 'taskpriority' => new ManiphestTaskPriorityDatasource(),
);
$sources = mpull($sources, 'getDatasourceURI');
@@ -601,7 +602,6 @@
'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
--- /dev/null
+++ b/src/applications/maniphest/typeahead/ManiphestTaskPriorityDatasource.php
@@ -0,0 +1,31 @@
+<?php
+
+final class ManiphestTaskPriorityDatasource
+ extends PhabricatorTypeaheadDatasource {
+
+ public function getPlaceholderText() {
+ return pht('Type a task priority name...');
+ }
+
+ public function getDatasourceApplicationClass() {
+ return 'PhabricatorApplicationManiphest';
+ }
+
+ public function loadResults() {
+ $viewer = $this->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
--- a/src/applications/typeahead/controller/PhabricatorTypeaheadCommonDatasourceController.php
+++ b/src/applications/typeahead/controller/PhabricatorTypeaheadCommonDatasourceController.php
@@ -33,7 +33,6 @@
$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 @@
case 'buildplans':
$need_build_plans = true;
break;
- case 'taskpriority':
- $need_task_priority = true;
- break;
}
$results = array();
@@ -225,16 +221,6 @@
}
}
- 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)

File Metadata

Mime Type
text/plain
Expires
Sat, May 11, 6:57 AM (3 w, 5 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6285027
Default Alt Text
D9877.id23716.diff (4 KB)

Event Timeline