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

Add a generic PHID-based object redirection controller

Summary:
Ref T13151. See PHI647. This allows us to link to any object by PHID, without disclosing information in the monogram (like `#fire-steve`).

This capability is relevant when building "secure mail", to provide a link to the object regardless of whether the monogram discloses information or not.

Test Plan: Visited `/object/D123/` (redirect), `/object/xyz/` (404), `/object/PHID-DREV-.../` (redirect).

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T13151

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

+42
+2
src/__phutil_library_map__.php
··· 4451 4451 'PhabricatorSystemDAO' => 'applications/system/storage/PhabricatorSystemDAO.php', 4452 4452 'PhabricatorSystemDestructionGarbageCollector' => 'applications/system/garbagecollector/PhabricatorSystemDestructionGarbageCollector.php', 4453 4453 'PhabricatorSystemDestructionLog' => 'applications/system/storage/PhabricatorSystemDestructionLog.php', 4454 + 'PhabricatorSystemObjectController' => 'applications/system/controller/PhabricatorSystemObjectController.php', 4454 4455 'PhabricatorSystemReadOnlyController' => 'applications/system/controller/PhabricatorSystemReadOnlyController.php', 4455 4456 'PhabricatorSystemRemoveDestroyWorkflow' => 'applications/system/management/PhabricatorSystemRemoveDestroyWorkflow.php', 4456 4457 'PhabricatorSystemRemoveLogWorkflow' => 'applications/system/management/PhabricatorSystemRemoveLogWorkflow.php', ··· 10406 10407 'PhabricatorSystemDAO' => 'PhabricatorLiskDAO', 10407 10408 'PhabricatorSystemDestructionGarbageCollector' => 'PhabricatorGarbageCollector', 10408 10409 'PhabricatorSystemDestructionLog' => 'PhabricatorSystemDAO', 10410 + 'PhabricatorSystemObjectController' => 'PhabricatorController', 10409 10411 'PhabricatorSystemReadOnlyController' => 'PhabricatorController', 10410 10412 'PhabricatorSystemRemoveDestroyWorkflow' => 'PhabricatorSystemRemoveWorkflow', 10411 10413 'PhabricatorSystemRemoveLogWorkflow' => 'PhabricatorSystemRemoveWorkflow',
+1
src/applications/system/application/PhabricatorSystemApplication.php
··· 26 26 '/readonly/' => array( 27 27 '(?P<reason>[^/]+)/' => 'PhabricatorSystemReadOnlyController', 28 28 ), 29 + '/object/(?P<name>[^/]+)/' => 'PhabricatorSystemObjectController', 29 30 ); 30 31 } 31 32
+39
src/applications/system/controller/PhabricatorSystemObjectController.php
··· 1 + <?php 2 + 3 + final class PhabricatorSystemObjectController 4 + extends PhabricatorController { 5 + 6 + public function shouldAllowPublic() { 7 + return true; 8 + } 9 + 10 + public function handleRequest(AphrontRequest $request) { 11 + $viewer = $this->getViewer(); 12 + $name = $request->getURIData('name'); 13 + 14 + $object = id(new PhabricatorObjectQuery()) 15 + ->setViewer($viewer) 16 + ->withNames(array($name)) 17 + ->executeOne(); 18 + if (!$object) { 19 + return new Aphront404Response(); 20 + } 21 + 22 + $phid = $object->getPHID(); 23 + $handles = $viewer->loadHandles(array($phid)); 24 + $handle = $handles[$phid]; 25 + 26 + $object_uri = $handle->getURI(); 27 + if (!strlen($object_uri)) { 28 + return $this->newDialog() 29 + ->setTitle(pht('No Object URI')) 30 + ->appendParagraph( 31 + pht( 32 + 'Object "%s" exists, but does not have a URI to redirect to.', 33 + $name)) 34 + ->addCancelButton('/', pht('Done')); 35 + } 36 + 37 + return id(new AphrontRedirectResponse())->setURI($object_uri); 38 + } 39 + }