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

Allow repositories to be filtered by type

Summary: Allows the user to query for repos by VCS type.

Test Plan: See screenshot.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

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

+38 -1
+14
src/applications/repository/query/PhabricatorRepositoryQuery.php
··· 6 6 private $ids; 7 7 private $phids; 8 8 private $callsigns; 9 + private $types; 9 10 10 11 const STATUS_OPEN = 'status-open'; 11 12 const STATUS_CLOSED = 'status-closed'; ··· 38 39 39 40 public function withStatus($status) { 40 41 $this->status = $status; 42 + return $this; 43 + } 44 + 45 + public function withTypes(array $types) { 46 + $this->types = $types; 41 47 return $this; 42 48 } 43 49 ··· 282 288 $conn_r, 283 289 'r.callsign IN (%Ls)', 284 290 $this->callsigns); 291 + } 292 + 293 + // TODO: Add a key for this. 294 + if ($this->types) { 295 + $where[] = qsprintf( 296 + $conn_r, 297 + 'r.versionControlSystem IN (%Ls)', 298 + $this->types); 285 299 } 286 300 287 301 $where[] = $this->buildPagingClause($conn_r);
+24 -1
src/applications/repository/query/PhabricatorRepositorySearchEngine.php
··· 9 9 $saved->setParameter('callsigns', $request->getStrList('callsigns')); 10 10 $saved->setParameter('status', $request->getStr('status')); 11 11 $saved->setParameter('order', $request->getStr('order')); 12 + $saved->setParameter('types', $request->getArr('types')); 12 13 13 14 return $saved; 14 15 } ··· 37 38 $query->setOrder(head($this->getOrderValues())); 38 39 } 39 40 41 + $types = $saved->getParameter('types'); 42 + if ($types) { 43 + $query->withTypes($types); 44 + } 45 + 40 46 return $query; 41 47 } 42 48 ··· 45 51 PhabricatorSavedQuery $saved_query) { 46 52 47 53 $callsigns = $saved_query->getParameter('callsigns', array()); 54 + $types = $saved_query->getParameter('types', array()); 55 + $types = array_fuse($types); 48 56 49 57 $form 50 58 ->appendChild( ··· 57 65 ->setName('status') 58 66 ->setLabel(pht('Status')) 59 67 ->setValue($saved_query->getParameter('status')) 60 - ->setOptions($this->getStatusOptions())) 68 + ->setOptions($this->getStatusOptions())); 69 + 70 + $type_control = id(new AphrontFormCheckboxControl()) 71 + ->setLabel(pht('Types')); 72 + 73 + $all_types = PhabricatorRepositoryType::getAllRepositoryTypes(); 74 + foreach ($all_types as $key => $name) { 75 + $type_control->addCheckbox( 76 + 'types[]', 77 + $key, 78 + $name, 79 + isset($types[$key])); 80 + } 81 + 82 + $form 83 + ->appendChild($type_control) 61 84 ->appendChild( 62 85 id(new AphrontFormSelectControl()) 63 86 ->setName('order')