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

Modernize "PhabricatorRepositoryPushLogSearchEngine"

Summary: Depends on D18917. Ref T13046. While I'm in here, update this to use more modern construction.

Test Plan: Browed and queried for push logs.

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T13046

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

+24 -47
+24 -47
src/applications/repository/query/PhabricatorRepositoryPushLogSearchEngine.php
··· 11 11 return 'PhabricatorDiffusionApplication'; 12 12 } 13 13 14 - public function buildSavedQueryFromRequest(AphrontRequest $request) { 15 - $saved = new PhabricatorSavedQuery(); 16 - 17 - $saved->setParameter( 18 - 'repositoryPHIDs', 19 - $this->readPHIDsFromRequest( 20 - $request, 21 - 'repositories', 22 - array( 23 - PhabricatorRepositoryRepositoryPHIDType::TYPECONST, 24 - ))); 25 - 26 - $saved->setParameter( 27 - 'pusherPHIDs', 28 - $this->readUsersFromRequest( 29 - $request, 30 - 'pushers')); 31 - 32 - return $saved; 14 + public function newQuery() { 15 + return new PhabricatorRepositoryPushLogQuery(); 33 16 } 34 17 35 - public function buildQueryFromSavedQuery(PhabricatorSavedQuery $saved) { 36 - $query = id(new PhabricatorRepositoryPushLogQuery()); 18 + protected function buildQueryFromParameters(array $map) { 19 + $query = $this->newQuery(); 37 20 38 - $repository_phids = $saved->getParameter('repositoryPHIDs'); 39 - if ($repository_phids) { 40 - $query->withRepositoryPHIDs($repository_phids); 21 + if ($map['repositoryPHIDs']) { 22 + $query->withRepositoryPHIDs($map['repositoryPHIDs']); 41 23 } 42 24 43 - $pusher_phids = $saved->getParameter('pusherPHIDs'); 44 - if ($pusher_phids) { 45 - $query->withPusherPHIDs($pusher_phids); 25 + if ($map['pusherPHIDs']) { 26 + $query->withPusherPHIDs($map['pusherPHIDs']); 46 27 } 47 28 48 29 return $query; 49 30 } 50 31 51 - public function buildSearchForm( 52 - AphrontFormView $form, 53 - PhabricatorSavedQuery $saved_query) { 54 - 55 - $repository_phids = $saved_query->getParameter('repositoryPHIDs', array()); 56 - $pusher_phids = $saved_query->getParameter('pusherPHIDs', array()); 57 - 58 - $form 59 - ->appendControl( 60 - id(new AphrontFormTokenizerControl()) 61 - ->setDatasource(new DiffusionRepositoryDatasource()) 62 - ->setName('repositories') 63 - ->setLabel(pht('Repositories')) 64 - ->setValue($repository_phids)) 65 - ->appendControl( 66 - id(new AphrontFormTokenizerControl()) 67 - ->setDatasource(new PhabricatorPeopleDatasource()) 68 - ->setName('pushers') 69 - ->setLabel(pht('Pushers')) 70 - ->setValue($pusher_phids)); 32 + protected function buildCustomSearchFields() { 33 + return array( 34 + id(new PhabricatorSearchDatasourceField()) 35 + ->setDatasource(new DiffusionRepositoryDatasource()) 36 + ->setKey('repositoryPHIDs') 37 + ->setAliases(array('repository', 'repositories', 'repositoryPHID')) 38 + ->setLabel(pht('Repositories')) 39 + ->setDescription( 40 + pht('Search for pull logs for specific repositories.')), 41 + id(new PhabricatorUsersSearchField()) 42 + ->setKey('pusherPHIDs') 43 + ->setAliases(array('pusher', 'pushers', 'pusherPHID')) 44 + ->setLabel(pht('Pushers')) 45 + ->setDescription( 46 + pht('Search for pull logs by specific users.')), 47 + ); 71 48 } 72 49 73 50 protected function getURI($path) {