Page MenuHomestyx hydra

No OneTemporary

diff --git a/src/applications/herald/typeahead/HeraldRuleDatasource.php b/src/applications/herald/typeahead/HeraldRuleDatasource.php
index c2db05c9ea..88343bd433 100644
--- a/src/applications/herald/typeahead/HeraldRuleDatasource.php
+++ b/src/applications/herald/typeahead/HeraldRuleDatasource.php
@@ -1,49 +1,57 @@
<?php
final class HeraldRuleDatasource
extends PhabricatorTypeaheadDatasource {
public function getPlaceholderText() {
return pht('Type a Herald rule name...');
}
public function getBrowseTitle() {
return pht('Browse Herald Rules');
}
public function getDatasourceApplicationClass() {
return 'PhabricatorHeraldApplication';
}
public function loadResults() {
$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)
->withPHIDs(mpull($rules, 'getPHID'))
->execute();
$results = array();
foreach ($rules as $rule) {
$handle = $handles[$rule->getPHID()];
$result = id(new PhabricatorTypeaheadResult())
->setName($handle->getFullName())
->setPHID($handle->getPHID());
if ($rule->getIsDisabled()) {
$result->setClosed(pht('Archived'));
}
$results[] = $result;
}
return $results;
}
}

File Metadata

Mime Type
text/x-diff
Expires
Mon, Apr 28, 7:19 AM (1 d, 14 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
107851
Default Alt Text
(1 KB)

Event Timeline