@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 upstream/main 119 lines 2.8 kB view raw
1<?php 2 3final class PhabricatorAuthInviteSearchEngine 4 extends PhabricatorApplicationSearchEngine { 5 6 public function getResultTypeDescription() { 7 return pht('Auth Email Invites'); 8 } 9 10 public function getApplicationClassName() { 11 return PhabricatorAuthApplication::class; 12 } 13 14 public function canUseInPanelContext() { 15 return false; 16 } 17 18 public function buildSavedQueryFromRequest(AphrontRequest $request) { 19 $saved = new PhabricatorSavedQuery(); 20 21 return $saved; 22 } 23 24 public function buildQueryFromSavedQuery(PhabricatorSavedQuery $saved) { 25 $query = new PhabricatorAuthInviteQuery(); 26 27 return $query; 28 } 29 30 public function buildSearchForm( 31 AphrontFormView $form, 32 PhabricatorSavedQuery $saved) {} 33 34 protected function getURI($path) { 35 return '/people/invite/'.$path; 36 } 37 38 protected function getBuiltinQueryNames() { 39 $names = array( 40 'all' => pht('All'), 41 ); 42 43 return $names; 44 } 45 46 public function buildSavedQueryFromBuiltin($query_key) { 47 $query = $this->newSavedQuery(); 48 $query->setQueryKey($query_key); 49 50 switch ($query_key) { 51 case 'all': 52 return $query; 53 } 54 55 return parent::buildSavedQueryFromBuiltin($query_key); 56 } 57 58 protected function getRequiredHandlePHIDsForResultList( 59 array $invites, 60 PhabricatorSavedQuery $query) { 61 62 $phids = array(); 63 foreach ($invites as $invite) { 64 $phids[$invite->getAuthorPHID()] = true; 65 if ($invite->getAcceptedByPHID()) { 66 $phids[$invite->getAcceptedByPHID()] = true; 67 } 68 } 69 70 return array_keys($phids); 71 } 72 73 /** 74 * @param array<PhabricatorAuthInvite> $invites 75 * @param PhabricatorSavedQuery $query 76 * @param array<PhabricatorObjectHandle> $handles 77 */ 78 protected function renderResultList( 79 array $invites, 80 PhabricatorSavedQuery $query, 81 array $handles) { 82 assert_instances_of($invites, PhabricatorAuthInvite::class); 83 84 $viewer = $this->requireViewer(); 85 86 $rows = array(); 87 foreach ($invites as $invite) { 88 $rows[] = array( 89 $invite->getEmailAddress(), 90 $handles[$invite->getAuthorPHID()]->renderLink(), 91 ($invite->getAcceptedByPHID() 92 ? $handles[$invite->getAcceptedByPHID()]->renderLink() 93 : null), 94 phabricator_datetime($invite->getDateCreated(), $viewer), 95 ); 96 } 97 98 $table = id(new AphrontTableView($rows)) 99 ->setHeaders( 100 array( 101 pht('Email Address'), 102 pht('Sent By'), 103 pht('Accepted By'), 104 pht('Invited'), 105 )) 106 ->setColumnClasses( 107 array( 108 '', 109 '', 110 'wide', 111 'right', 112 )); 113 114 $result = new PhabricatorApplicationSearchResultView(); 115 $result->setTable($table); 116 117 return $result; 118 } 119}