1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-26 08:42: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(); $viewer = $this->getViewer();
$raw_query = $this->getRawQuery(); $raw_query = $this->getRawQuery();
$rules = id(new HeraldRuleQuery()) $query = id(new HeraldRuleQuery())
->setViewer($viewer) ->setViewer($viewer);
->withDatasourceQuery($raw_query)
->execute(); 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()) $handles = id(new PhabricatorHandleQuery())
->setViewer($viewer) ->setViewer($viewer)