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

Configure Feed

Select the types of activity you want to include in your feed.

When a user pastes a Phabricator URI into the search box, redirect to the URI

Summary:
Depends on D20509. See PHI1224. Ref T5378. With some frequency, I paste URIs into the global search input (I am dumb).

When I do this dumb thing, redirect to the URI as though the global search was a URI bar.

Maybe only I am dumb like this, but I don't think it'll hurt anything.

Test Plan: pasted a URI and hit return; tried to eat a rock

Reviewers: amckinley, joshuaspence

Reviewed By: joshuaspence

Maniphest Tasks: T5378

Differential Revision: https://secure.phabricator.com/D20510

+36
+2
src/__phutil_library_map__.php
··· 3040 3040 'PhabricatorDatasourceEditType' => 'applications/transactions/edittype/PhabricatorDatasourceEditType.php', 3041 3041 'PhabricatorDatasourceEngine' => 'applications/search/engine/PhabricatorDatasourceEngine.php', 3042 3042 'PhabricatorDatasourceEngineExtension' => 'applications/search/engineextension/PhabricatorDatasourceEngineExtension.php', 3043 + 'PhabricatorDatasourceURIEngineExtension' => 'applications/meta/engineextension/PhabricatorDatasourceURIEngineExtension.php', 3043 3044 'PhabricatorDateFormatSetting' => 'applications/settings/setting/PhabricatorDateFormatSetting.php', 3044 3045 'PhabricatorDateTimeSettingsPanel' => 'applications/settings/panel/PhabricatorDateTimeSettingsPanel.php', 3045 3046 'PhabricatorDebugController' => 'applications/system/controller/PhabricatorDebugController.php', ··· 9082 9083 'PhabricatorDatasourceEditType' => 'PhabricatorPHIDListEditType', 9083 9084 'PhabricatorDatasourceEngine' => 'Phobject', 9084 9085 'PhabricatorDatasourceEngineExtension' => 'Phobject', 9086 + 'PhabricatorDatasourceURIEngineExtension' => 'PhabricatorDatasourceEngineExtension', 9085 9087 'PhabricatorDateFormatSetting' => 'PhabricatorSelectSetting', 9086 9088 'PhabricatorDateTimeSettingsPanel' => 'PhabricatorEditEngineSettingsPanel', 9087 9089 'PhabricatorDebugController' => 'PhabricatorController',
+34
src/applications/meta/engineextension/PhabricatorDatasourceURIEngineExtension.php
··· 1 + <?php 2 + 3 + final class PhabricatorDatasourceURIEngineExtension 4 + extends PhabricatorDatasourceEngineExtension { 5 + 6 + public function newQuickSearchDatasources() { 7 + return array(); 8 + } 9 + 10 + public function newJumpURI($query) { 11 + // If you search for a URI on the local install, just redirect to that 12 + // URI as though you had pasted it into the URI bar. 13 + if (PhabricatorEnv::isSelfURI($query)) { 14 + // Strip off the absolute part of the URI. If we don't, the URI redirect 15 + // validator will get upset that we're performing an unmarked external 16 + // redirect. 17 + 18 + // The correct host and protocol may also differ from the host and 19 + // protocol used in the search: for example, if you search for "http://" 20 + // we want to redirect to "https://" if an install is HTTPS, and 21 + // the "isSelfURI()" check includes alternate domains in addition to the 22 + // canonical domain. 23 + 24 + $uri = id(new PhutilURI($query)) 25 + ->setDomain(null) 26 + ->setProtocol(null) 27 + ->setPort(null); 28 + 29 + return phutil_string_cast($uri); 30 + } 31 + 32 + return null; 33 + } 34 + }