@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Modernize "task priority" datasource

Summary: Ref T4420.

Test Plan:
- Used typeahead in Herald rules.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T4420

Differential Revision: https://secure.phabricator.com/D9877

+34 -15
+2
src/__phutil_library_map__.php
··· 944 944 'ManiphestTaskMailReceiver' => 'applications/maniphest/mail/ManiphestTaskMailReceiver.php', 945 945 'ManiphestTaskOwner' => 'applications/maniphest/constants/ManiphestTaskOwner.php', 946 946 'ManiphestTaskPriority' => 'applications/maniphest/constants/ManiphestTaskPriority.php', 947 + 'ManiphestTaskPriorityDatasource' => 'applications/maniphest/typeahead/ManiphestTaskPriorityDatasource.php', 947 948 'ManiphestTaskProject' => 'applications/maniphest/storage/ManiphestTaskProject.php', 948 949 'ManiphestTaskQuery' => 'applications/maniphest/query/ManiphestTaskQuery.php', 949 950 'ManiphestTaskResultListView' => 'applications/maniphest/view/ManiphestTaskResultListView.php', ··· 3724 3725 'ManiphestTaskMailReceiver' => 'PhabricatorObjectMailReceiver', 3725 3726 'ManiphestTaskOwner' => 'ManiphestConstants', 3726 3727 'ManiphestTaskPriority' => 'ManiphestConstants', 3728 + 'ManiphestTaskPriorityDatasource' => 'PhabricatorTypeaheadDatasource', 3727 3729 'ManiphestTaskProject' => 'ManiphestDAO', 3728 3730 'ManiphestTaskQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', 3729 3731 'ManiphestTaskResultListView' => 'ManiphestView',
+1 -1
src/applications/herald/controller/HeraldRuleController.php
··· 591 591 $sources = array( 592 592 'repository' => new DiffusionRepositoryDatasource(), 593 593 'legaldocuments' => new LegalpadDocumentDatasource(), 594 + 'taskpriority' => new ManiphestTaskPriorityDatasource(), 594 595 ); 595 596 596 597 $sources = mpull($sources, 'getDatasourceURI'); ··· 601 602 'project' => '/typeahead/common/projects/', 602 603 'userorproject' => '/typeahead/common/accountsorprojects/', 603 604 'buildplan' => '/typeahead/common/buildplans/', 604 - 'taskpriority' => '/typeahead/common/taskpriority/', 605 605 'arcanistprojects' => '/typeahead/common/arcanistprojects/', 606 606 ); 607 607
+31
src/applications/maniphest/typeahead/ManiphestTaskPriorityDatasource.php
··· 1 + <?php 2 + 3 + final class ManiphestTaskPriorityDatasource 4 + extends PhabricatorTypeaheadDatasource { 5 + 6 + public function getPlaceholderText() { 7 + return pht('Type a task priority name...'); 8 + } 9 + 10 + public function getDatasourceApplicationClass() { 11 + return 'PhabricatorApplicationManiphest'; 12 + } 13 + 14 + public function loadResults() { 15 + $viewer = $this->getViewer(); 16 + $raw_query = $this->getRawQuery(); 17 + 18 + $results = array(); 19 + 20 + $priority_map = ManiphestTaskPriority::getTaskPriorityMap(); 21 + foreach ($priority_map as $value => $name) { 22 + // NOTE: $value is not a phid but is unique. This'll work. 23 + $results[] = id(new PhabricatorTypeaheadResult()) 24 + ->setPHID($value) 25 + ->setName($name); 26 + } 27 + 28 + return $results; 29 + } 30 + 31 + }
-14
src/applications/typeahead/controller/PhabricatorTypeaheadCommonDatasourceController.php
··· 33 33 $need_symbols = false; 34 34 $need_jump_objects = false; 35 35 $need_build_plans = false; 36 - $need_task_priority = false; 37 36 switch ($this->type) { 38 37 case 'mainsearch': 39 38 $need_users = true; ··· 83 82 break; 84 83 case 'buildplans': 85 84 $need_build_plans = true; 86 - break; 87 - case 'taskpriority': 88 - $need_task_priority = true; 89 85 break; 90 86 } 91 87 ··· 222 218 $results[] = id(new PhabricatorTypeaheadResult()) 223 219 ->setName($plan->getName()) 224 220 ->setPHID($plan->getPHID()); 225 - } 226 - } 227 - 228 - if ($need_task_priority) { 229 - $priority_map = ManiphestTaskPriority::getTaskPriorityMap(); 230 - foreach ($priority_map as $value => $name) { 231 - // NOTE: $value is not a phid but is unique. This'll work. 232 - $results[] = id(new PhabricatorTypeaheadResult()) 233 - ->setPHID($value) 234 - ->setName($name); 235 221 } 236 222 } 237 223