mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-22 05:20:56 +01:00
Calendar event monograms, part 4. Typing E{id} makes the object available in global search.
Summary: Closes T7928, E{id} is available via global search. Test Plan: Create calendar event, search for its monogram in global search, event should be accessible. Reviewers: #blessed_reviewers, epriestley Reviewed By: #blessed_reviewers, epriestley Subscribers: Korvin, epriestley Maniphest Tasks: T7928 Differential Revision: https://secure.phabricator.com/D12581
This commit is contained in:
parent
75408d1381
commit
3b226e8fb3
2 changed files with 29 additions and 1 deletions
|
@ -38,4 +38,32 @@ final class PhabricatorCalendarEventPHIDType extends PhabricatorPHIDType {
|
|||
}
|
||||
}
|
||||
|
||||
public function canLoadNamedObject($name) {
|
||||
return preg_match('/^E[1-9]\d*$/i', $name);
|
||||
}
|
||||
|
||||
public function loadNamedObjects(
|
||||
PhabricatorObjectQuery $query,
|
||||
array $names) {
|
||||
|
||||
$id_map = array();
|
||||
foreach ($names as $name) {
|
||||
$id = (int)substr($name, 1);
|
||||
$id_map[$id][] = $name;
|
||||
}
|
||||
|
||||
$objects = id(new PhabricatorCalendarEventQuery())
|
||||
->setViewer($query->getViewer())
|
||||
->withIDs(array_keys($id_map))
|
||||
->execute();
|
||||
|
||||
$results = array();
|
||||
foreach ($objects as $id => $object) {
|
||||
foreach (idx($id_map, $id, array()) as $name) {
|
||||
$results[$name] = $object;
|
||||
}
|
||||
}
|
||||
|
||||
return $results;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ final class DifferentialRevisionPHIDType extends PhabricatorPHIDType {
|
|||
}
|
||||
|
||||
public function canLoadNamedObject($name) {
|
||||
return preg_match('/^D\d*[1-9]\d*$/i', $name);
|
||||
return preg_match('/^D[1-9]\d*$/i', $name);
|
||||
}
|
||||
|
||||
public function loadNamedObjects(
|
||||
|
|
Loading…
Reference in a new issue