@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.)
hq.recaptime.dev/wiki/Phorge
phorge
phabricator
1<?php
2
3final 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}