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 @@ -1866,6 +1866,7 @@ 'PhabricatorOwnersOwner' => 'applications/owners/storage/PhabricatorOwnersOwner.php', 'PhabricatorOwnersPHIDTypePackage' => 'applications/owners/phid/PhabricatorOwnersPHIDTypePackage.php', 'PhabricatorOwnersPackage' => 'applications/owners/storage/PhabricatorOwnersPackage.php', + 'PhabricatorOwnersPackageDatasource' => 'applications/owners/typeahead/PhabricatorOwnersPackageDatasource.php', 'PhabricatorOwnersPackagePathValidator' => 'applications/repository/worker/commitchangeparser/PhabricatorOwnersPackagePathValidator.php', 'PhabricatorOwnersPackageQuery' => 'applications/owners/query/PhabricatorOwnersPackageQuery.php', 'PhabricatorOwnersPackageTestCase' => 'applications/owners/storage/__tests__/PhabricatorOwnersPackageTestCase.php', @@ -4718,6 +4719,7 @@ 0 => 'PhabricatorOwnersDAO', 1 => 'PhabricatorPolicyInterface', ), + 'PhabricatorOwnersPackageDatasource' => 'PhabricatorTypeaheadDatasource', 'PhabricatorOwnersPackageQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', 'PhabricatorOwnersPackageTestCase' => 'PhabricatorTestCase', 'PhabricatorOwnersPath' => 'PhabricatorOwnersDAO', 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 @@ -594,13 +594,13 @@ 'taskpriority' => new ManiphestTaskPriorityDatasource(), 'buildplan' => new HarbormasterBuildPlanDatasource(), 'arcanistprojects' => new DiffusionArcanistProjectDatasource(), + 'package' => new PhabricatorOwnersPackageDatasource(), ); $sources = mpull($sources, 'getDatasourceURI'); $sources += array( 'email' => '/typeahead/common/mailable/', 'user' => '/typeahead/common/accounts/', - 'package' => '/typeahead/common/packages/', 'project' => '/typeahead/common/projects/', 'userorproject' => '/typeahead/common/accountsorprojects/', ); diff --git a/src/applications/owners/typeahead/PhabricatorOwnersPackageDatasource.php b/src/applications/owners/typeahead/PhabricatorOwnersPackageDatasource.php new file mode 100644 --- /dev/null +++ b/src/applications/owners/typeahead/PhabricatorOwnersPackageDatasource.php @@ -0,0 +1,35 @@ +getViewer(); + $raw_query = $this->getRawQuery(); + + $results = array(); + + $packages = id(new PhabricatorOwnersPackageQuery()) + ->setViewer($viewer) + ->execute(); + + foreach ($packages as $package) { + $results[] = id(new PhabricatorTypeaheadResult()) + ->setIcon('fa-list-alt bluegrey') + ->setName($package->getName()) + ->setURI('/owners/package/'.$package->getID().'/') + ->setPHID($package->getPHID()); + } + + 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 @@ -72,9 +72,6 @@ $need_projs = true; $need_packages = true; break; - case 'packages': - $need_packages = true; - break; } $results = array();