Page MenuHomePhabricator

D12434.diff
No OneTemporary

D12434.diff

diff --git a/src/applications/diffusion/typeahead/DiffusionRepositoryDatasource.php b/src/applications/diffusion/typeahead/DiffusionRepositoryDatasource.php
--- a/src/applications/diffusion/typeahead/DiffusionRepositoryDatasource.php
+++ b/src/applications/diffusion/typeahead/DiffusionRepositoryDatasource.php
@@ -15,11 +15,12 @@
$viewer = $this->getViewer();
$raw_query = $this->getRawQuery();
- $results = array();
+ $query = id(new PhabricatorRepositoryQuery())
+ ->setOrder('name')
+ ->withDatasourceQuery($raw_query);
+ $repos = $this->executeQuery($query);
- $repos = id(new PhabricatorRepositoryQuery())
- ->setViewer($viewer)
- ->execute();
+ $results = array();
foreach ($repos as $repo) {
$results[] = id(new PhabricatorTypeaheadResult())
->setName($repo->getMonogram().' '.$repo->getName())
diff --git a/src/applications/repository/query/PhabricatorRepositoryQuery.php b/src/applications/repository/query/PhabricatorRepositoryQuery.php
--- a/src/applications/repository/query/PhabricatorRepositoryQuery.php
+++ b/src/applications/repository/query/PhabricatorRepositoryQuery.php
@@ -11,6 +11,7 @@
private $nameContains;
private $remoteURIs;
private $anyProjectPHIDs;
+ private $datasourceQuery;
private $numericIdentifiers;
private $callsignIdentifiers;
@@ -103,6 +104,11 @@
return $this;
}
+ public function withDatasourceQuery($query) {
+ $this->datasourceQuery = $query;
+ return $this;
+ }
+
public function needCommitCounts($need_counts) {
$this->needCommitCounts = $need_counts;
return $this;
@@ -493,6 +499,21 @@
$this->anyProjectPHIDs);
}
+ if (strlen($this->datasourceQuery)) {
+ // This handles having "rP" match callsigns starting with "P...".
+ $query = trim($this->datasourceQuery);
+ if (preg_match('/^r/', $query)) {
+ $callsign = substr($query, 1);
+ } else {
+ $callsign = $query;
+ }
+ $where[] = qsprintf(
+ $conn_r,
+ 'r.name LIKE %> OR r.callsign LIKE %>',
+ $query,
+ $callsign);
+ }
+
$where[] = $this->buildPagingClause($conn_r);
return $this->formatWhereClause($where);

File Metadata

Mime Type
text/plain
Expires
Sun, May 12, 3:35 AM (1 w, 4 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6288203
Default Alt Text
D12434.diff (2 KB)

Event Timeline