1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-19 05:12:41 +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:
lkassianik 2015-04-27 15:31:18 -07:00
parent 75408d1381
commit 3b226e8fb3
2 changed files with 29 additions and 1 deletions

View file

@ -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;
}
}

View file

@ -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(