diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index a00b8e35c7..45d31361d0 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -4940,6 +4940,7 @@ phutil_register_library_map(array( 'PhabricatorUserIconField' => 'applications/people/customfield/PhabricatorUserIconField.php', 'PhabricatorUserLog' => 'applications/people/storage/PhabricatorUserLog.php', 'PhabricatorUserLogType' => 'applications/people/userlog/PhabricatorUserLogType.php', + 'PhabricatorUserLogTypeDatasource' => 'applications/people/typeahead/PhabricatorUserLogTypeDatasource.php', 'PhabricatorUserLogView' => 'applications/people/view/PhabricatorUserLogView.php', 'PhabricatorUserMessageCountCacheType' => 'applications/people/cache/PhabricatorUserMessageCountCacheType.php', 'PhabricatorUserNotificationCountCacheType' => 'applications/people/cache/PhabricatorUserNotificationCountCacheType.php', @@ -11377,6 +11378,7 @@ phutil_register_library_map(array( 'PhabricatorPolicyInterface', ), 'PhabricatorUserLogType' => 'Phobject', + 'PhabricatorUserLogTypeDatasource' => 'PhabricatorTypeaheadDatasource', 'PhabricatorUserLogView' => 'AphrontView', 'PhabricatorUserMessageCountCacheType' => 'PhabricatorUserCacheType', 'PhabricatorUserNotificationCountCacheType' => 'PhabricatorUserCacheType', diff --git a/src/applications/people/query/PhabricatorPeopleLogSearchEngine.php b/src/applications/people/query/PhabricatorPeopleLogSearchEngine.php index ad37395b88..7e7fca1cd4 100644 --- a/src/applications/people/query/PhabricatorPeopleLogSearchEngine.php +++ b/src/applications/people/query/PhabricatorPeopleLogSearchEngine.php @@ -78,11 +78,11 @@ final class PhabricatorPeopleLogSearchEngine ->setAliases(array('actors', 'actor', 'actorPHID')) ->setLabel(pht('Actors')) ->setDescription(pht('Search for activity by specific users.')), - id(new PhabricatorSearchCheckboxesField()) + id(new PhabricatorSearchDatasourceField()) ->setKey('actions') ->setLabel(pht('Actions')) ->setDescription(pht('Search for particular types of activity.')) - ->setOptions($types), + ->setDatasource(new PhabricatorUserLogTypeDatasource()), id(new PhabricatorSearchTextField()) ->setKey('ip') ->setLabel(pht('Filter IP')) diff --git a/src/applications/people/typeahead/PhabricatorUserLogTypeDatasource.php b/src/applications/people/typeahead/PhabricatorUserLogTypeDatasource.php new file mode 100644 index 0000000000..39241a020c --- /dev/null +++ b/src/applications/people/typeahead/PhabricatorUserLogTypeDatasource.php @@ -0,0 +1,43 @@ +buildResults(); + return $this->filterResultsAgainstTokens($results); + } + + protected function renderSpecialTokens(array $values) { + return $this->renderTokensFromResults($this->buildResults(), $values); + } + + private function buildResults() { + $results = array(); + + $type_map = PhabricatorUserLogType::getAllLogTypes(); + foreach ($type_map as $type_key => $type) { + + $result = id(new PhabricatorTypeaheadResult()) + ->setPHID($type_key) + ->setName($type->getLogTypeName()); + + $results[$type_key] = $result; + } + + return $results; + } + +}