Commit 3b226e8f authored by lkassianik's avatar lkassianik
Browse files

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
parent 75408d13
......@@ -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(
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment