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

Project - use hashtag as a way to access project profile in URI, e.g. /project/hashtag/

Summary: Fixes T4022. Hooks up the project profile controller to understanding URIs like /project/hashtag/ Also, makes handles have the new /project/hashtag/ URI by default, thus upselling that feature super duper heavily.

Test Plan: clicked some project links, noted pretty uri and page working nicely.

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: chad, epriestley, Korvin

Maniphest Tasks: T4022

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

+23 -6
+4
src/applications/project/application/PhabricatorApplicationProject.php
··· 67 67 'history/(?P<id>[1-9]\d*)/' => 'PhabricatorProjectHistoryController', 68 68 '(?P<action>watch|unwatch)/(?P<id>[1-9]\d*)/' 69 69 => 'PhabricatorProjectWatchController', 70 + 71 + ), 72 + '/tag/' => array( 73 + '(?P<slug>[^/]+)/' => 'PhabricatorProjectProfileController', 70 74 ), 71 75 ); 72 76 }
+16 -4
src/applications/project/controller/PhabricatorProjectProfileController.php
··· 4 4 extends PhabricatorProjectController { 5 5 6 6 private $id; 7 + private $slug; 7 8 8 9 public function shouldAllowPublic() { 9 10 return true; 10 11 } 11 12 12 13 public function willProcessRequest(array $data) { 14 + // via /project/view/$id/ 13 15 $this->id = idx($data, 'id'); 16 + // via /tag/$slug/ 17 + $this->slug = idx($data, 'slug'); 14 18 } 15 19 16 20 public function processRequest() { 17 21 $request = $this->getRequest(); 18 22 $user = $request->getUser(); 19 23 20 - $project = id(new PhabricatorProjectQuery()) 24 + $query = id(new PhabricatorProjectQuery()) 21 25 ->setViewer($user) 22 - ->withIDs(array($this->id)) 23 26 ->needMembers(true) 24 27 ->needWatchers(true) 25 - ->needImages(true) 26 - ->executeOne(); 28 + ->needImages(true); 29 + if ($this->slug) { 30 + $query->withSlugs(array($this->slug)); 31 + } else { 32 + $query->withIDs(array($this->id)); 33 + } 34 + $project = $query->executeOne(); 27 35 if (!$project) { 28 36 return new Aphront404Response(); 37 + } 38 + if ($this->slug && $this->slug != $project->getPrimarySlug()) { 39 + return id(new AphrontRedirectResponse()) 40 + ->setURI('/tag/'.$project->getPrimarySlug().'/'); 29 41 } 30 42 31 43 $picture = $project->getProfileImageURI();
+3 -2
src/applications/project/phid/PhabricatorProjectPHIDTypeProject.php
··· 43 43 44 44 $name = $project->getName(); 45 45 $id = $project->getID(); 46 + $slug = $project->getPrimarySlug(); 46 47 47 48 $handle->setName($name); 48 - $handle->setObjectName('#'.rtrim($project->getPhrictionSlug(), '/')); 49 - $handle->setURI("/project/view/{$id}/"); 49 + $handle->setObjectName('#'.$slug); 50 + $handle->setURI("/tag/{$slug}/"); 50 51 $handle->setImageURI($project->getProfileImageURI()); 51 52 52 53 if ($project->isArchived()) {