@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.

Give user log types a tokenizer and datasource instead of a page of checkboxes

Summary: Depends on D20671. Ref T13343. Now that log types are modular, provide a datasource/tokenizer for selecting them since we already have a lot (even after I purged a few in D20670) and I'm planning to add at least one more ("Request password reset").

Test Plan: {F6608534}

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T13343

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

+47 -2
+2
src/__phutil_library_map__.php
··· 4940 4940 'PhabricatorUserIconField' => 'applications/people/customfield/PhabricatorUserIconField.php', 4941 4941 'PhabricatorUserLog' => 'applications/people/storage/PhabricatorUserLog.php', 4942 4942 'PhabricatorUserLogType' => 'applications/people/userlog/PhabricatorUserLogType.php', 4943 + 'PhabricatorUserLogTypeDatasource' => 'applications/people/typeahead/PhabricatorUserLogTypeDatasource.php', 4943 4944 'PhabricatorUserLogView' => 'applications/people/view/PhabricatorUserLogView.php', 4944 4945 'PhabricatorUserMessageCountCacheType' => 'applications/people/cache/PhabricatorUserMessageCountCacheType.php', 4945 4946 'PhabricatorUserNotificationCountCacheType' => 'applications/people/cache/PhabricatorUserNotificationCountCacheType.php', ··· 11377 11378 'PhabricatorPolicyInterface', 11378 11379 ), 11379 11380 'PhabricatorUserLogType' => 'Phobject', 11381 + 'PhabricatorUserLogTypeDatasource' => 'PhabricatorTypeaheadDatasource', 11380 11382 'PhabricatorUserLogView' => 'AphrontView', 11381 11383 'PhabricatorUserMessageCountCacheType' => 'PhabricatorUserCacheType', 11382 11384 'PhabricatorUserNotificationCountCacheType' => 'PhabricatorUserCacheType',
+2 -2
src/applications/people/query/PhabricatorPeopleLogSearchEngine.php
··· 78 78 ->setAliases(array('actors', 'actor', 'actorPHID')) 79 79 ->setLabel(pht('Actors')) 80 80 ->setDescription(pht('Search for activity by specific users.')), 81 - id(new PhabricatorSearchCheckboxesField()) 81 + id(new PhabricatorSearchDatasourceField()) 82 82 ->setKey('actions') 83 83 ->setLabel(pht('Actions')) 84 84 ->setDescription(pht('Search for particular types of activity.')) 85 - ->setOptions($types), 85 + ->setDatasource(new PhabricatorUserLogTypeDatasource()), 86 86 id(new PhabricatorSearchTextField()) 87 87 ->setKey('ip') 88 88 ->setLabel(pht('Filter IP'))
+43
src/applications/people/typeahead/PhabricatorUserLogTypeDatasource.php
··· 1 + <?php 2 + 3 + final class PhabricatorUserLogTypeDatasource 4 + extends PhabricatorTypeaheadDatasource { 5 + 6 + public function getBrowseTitle() { 7 + return pht('Browse Log Types'); 8 + } 9 + 10 + public function getPlaceholderText() { 11 + return pht('Type a log type name...'); 12 + } 13 + 14 + public function getDatasourceApplicationClass() { 15 + return 'PhabricatorPeopleApplication'; 16 + } 17 + 18 + public function loadResults() { 19 + $results = $this->buildResults(); 20 + return $this->filterResultsAgainstTokens($results); 21 + } 22 + 23 + protected function renderSpecialTokens(array $values) { 24 + return $this->renderTokensFromResults($this->buildResults(), $values); 25 + } 26 + 27 + private function buildResults() { 28 + $results = array(); 29 + 30 + $type_map = PhabricatorUserLogType::getAllLogTypes(); 31 + foreach ($type_map as $type_key => $type) { 32 + 33 + $result = id(new PhabricatorTypeaheadResult()) 34 + ->setPHID($type_key) 35 + ->setName($type->getLogTypeName()); 36 + 37 + $results[$type_key] = $result; 38 + } 39 + 40 + return $results; 41 + } 42 + 43 + }