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

at recaptime-dev/main 86 lines 2.0 kB view raw
1<?php 2 3final class PhabricatorCalendarImportLogSearchEngine 4 extends PhabricatorApplicationSearchEngine { 5 6 public function getResultTypeDescription() { 7 return pht('Calendar Import Logs'); 8 } 9 10 public function getApplicationClassName() { 11 return PhabricatorCalendarApplication::class; 12 } 13 14 public function canUseInPanelContext() { 15 return false; 16 } 17 18 public function newQuery() { 19 return new PhabricatorCalendarImportLogQuery(); 20 } 21 22 protected function buildCustomSearchFields() { 23 return array( 24 id(new PhabricatorPHIDsSearchField()) 25 ->setLabel(pht('Import Sources')) 26 ->setKey('importSourcePHIDs') 27 ->setAliases(array('importSourcePHID')), 28 ); 29 } 30 31 protected function buildQueryFromParameters(array $map) { 32 $query = $this->newQuery(); 33 34 if ($map['importSourcePHIDs']) { 35 $query->withImportPHIDs($map['importSourcePHIDs']); 36 } 37 38 return $query; 39 } 40 41 protected function getURI($path) { 42 return '/calendar/import/log/'.$path; 43 } 44 45 protected function getBuiltinQueryNames() { 46 $names = array( 47 'all' => pht('All Logs'), 48 ); 49 50 return $names; 51 } 52 53 public function buildSavedQueryFromBuiltin($query_key) { 54 $query = $this->newSavedQuery(); 55 $query->setQueryKey($query_key); 56 57 switch ($query_key) { 58 case 'all': 59 return $query; 60 } 61 62 return parent::buildSavedQueryFromBuiltin($query_key); 63 } 64 65 /** 66 * @param array<PhabricatorCalendarImportLog> $logs 67 * @param PhabricatorSavedQuery $query 68 * @param array<PhabricatorObjectHandle> $handles 69 */ 70 protected function renderResultList( 71 array $logs, 72 PhabricatorSavedQuery $query, 73 array $handles) { 74 75 assert_instances_of($logs, PhabricatorCalendarImportLog::class); 76 $viewer = $this->requireViewer(); 77 78 $view = id(new PhabricatorCalendarImportLogView()) 79 ->setShowImportSources(true) 80 ->setViewer($viewer) 81 ->setLogs($logs); 82 83 return id(new PhabricatorApplicationSearchResultView()) 84 ->setTable($view->newTable()); 85 } 86}