Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/phabricator
Path: blob/master/src/applications/people/engineextension/PhabricatorPeopleDatasourceEngineExtension.php
12256 views
1
<?php
2
3
final class PhabricatorPeopleDatasourceEngineExtension
4
extends PhabricatorDatasourceEngineExtension {
5
6
public function newQuickSearchDatasources() {
7
return array(
8
new PhabricatorPeopleDatasource(),
9
);
10
}
11
12
public function newJumpURI($query) {
13
$viewer = $this->getViewer();
14
15
// Send "u" to the user directory.
16
if (preg_match('/^u\z/i', $query)) {
17
return '/people/';
18
}
19
20
// Send "u <string>" to the user's profile page.
21
$matches = null;
22
if (preg_match('/^u\s+(.+)\z/i', $query, $matches)) {
23
$raw_query = $matches[1];
24
25
// TODO: We could test that this is a valid username and jump to
26
// a search in the user directory if it isn't.
27
28
return urisprintf(
29
'/p/%s/',
30
$raw_query);
31
}
32
33
return null;
34
}
35
36
}
37
38