1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-22 14:52:41 +01:00

Support querying Herald rules by monogram in typeahead datsources

Summary:
Depends on D19556. See PHI765. Ref T13164. Currently, if you type `H1` in this datasource, it isn't smart enough to pull up the right object.

Add support for querying by monogram. This is similar to existing support in Owners packages, etc.

Test Plan: Typed `H1` in the new push log filter, got the right object as a result in the typeahead.

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T13164

Differential Revision: https://secure.phabricator.com/D19557
This commit is contained in:
epriestley 2018-08-01 12:45:00 -07:00
parent 06380e8079
commit e72296f927

View file

@ -19,10 +19,18 @@ final class HeraldRuleDatasource
$viewer = $this->getViewer();
$raw_query = $this->getRawQuery();
$rules = id(new HeraldRuleQuery())
->setViewer($viewer)
->withDatasourceQuery($raw_query)
->execute();
$query = id(new HeraldRuleQuery())
->setViewer($viewer);
if (preg_match('/^[hH]\d+\z/', $raw_query)) {
$id = trim($raw_query, 'hH');
$id = (int)$id;
$query->withIDs(array($id));
} else {
$query->withDatasourceQuery($raw_query);
}
$rules = $query->execute();
$handles = id(new PhabricatorHandleQuery())
->setViewer($viewer)