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 @@ -4940,6 +4940,7 @@ '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 @@ '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 --- a/src/applications/people/query/PhabricatorPeopleLogSearchEngine.php +++ b/src/applications/people/query/PhabricatorPeopleLogSearchEngine.php @@ -78,11 +78,11 @@ ->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 --- /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; + } + +}