Page MenuHomePhabricator

D20672.diff
No OneTemporary

D20672.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
@@ -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 @@
+<?php
+
+final class PhabricatorUserLogTypeDatasource
+ extends PhabricatorTypeaheadDatasource {
+
+ public function getBrowseTitle() {
+ return pht('Browse Log Types');
+ }
+
+ public function getPlaceholderText() {
+ return pht('Type a log type name...');
+ }
+
+ public function getDatasourceApplicationClass() {
+ return 'PhabricatorPeopleApplication';
+ }
+
+ public function loadResults() {
+ $results = $this->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;
+ }
+
+}

File Metadata

Mime Type
text/plain
Expires
Mon, Mar 10, 6:31 PM (1 w, 6 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7463524
Default Alt Text
D20672.diff (3 KB)

Event Timeline