Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15381463
D9260.id21996.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D9260.id21996.diff
View Options
diff --git a/src/applications/project/application/PhabricatorApplicationProject.php b/src/applications/project/application/PhabricatorApplicationProject.php
--- a/src/applications/project/application/PhabricatorApplicationProject.php
+++ b/src/applications/project/application/PhabricatorApplicationProject.php
@@ -67,6 +67,10 @@
'history/(?P<id>[1-9]\d*)/' => 'PhabricatorProjectHistoryController',
'(?P<action>watch|unwatch)/(?P<id>[1-9]\d*)/'
=> 'PhabricatorProjectWatchController',
+
+ ),
+ '/tag/' => array(
+ '(?P<slug>[^/]+)/' => 'PhabricatorProjectProfileController',
),
);
}
diff --git a/src/applications/project/controller/PhabricatorProjectProfileController.php b/src/applications/project/controller/PhabricatorProjectProfileController.php
--- a/src/applications/project/controller/PhabricatorProjectProfileController.php
+++ b/src/applications/project/controller/PhabricatorProjectProfileController.php
@@ -4,29 +4,41 @@
extends PhabricatorProjectController {
private $id;
+ private $slug;
public function shouldAllowPublic() {
return true;
}
public function willProcessRequest(array $data) {
+ // via /project/view/$id/
$this->id = idx($data, 'id');
+ // via /tag/$slug/
+ $this->slug = idx($data, 'slug');
}
public function processRequest() {
$request = $this->getRequest();
$user = $request->getUser();
- $project = id(new PhabricatorProjectQuery())
+ $query = id(new PhabricatorProjectQuery())
->setViewer($user)
- ->withIDs(array($this->id))
->needMembers(true)
->needWatchers(true)
- ->needImages(true)
- ->executeOne();
+ ->needImages(true);
+ if ($this->slug) {
+ $query->withSlugs(array($this->slug));
+ } else {
+ $query->withIDs(array($this->id));
+ }
+ $project = $query->executeOne();
if (!$project) {
return new Aphront404Response();
}
+ if ($this->slug && $this->slug != $project->getPrimarySlug()) {
+ return id(new AphrontRedirectResponse())
+ ->setURI('/tag/'.$project->getPrimarySlug().'/');
+ }
$picture = $project->getProfileImageURI();
diff --git a/src/applications/project/phid/PhabricatorProjectPHIDTypeProject.php b/src/applications/project/phid/PhabricatorProjectPHIDTypeProject.php
--- a/src/applications/project/phid/PhabricatorProjectPHIDTypeProject.php
+++ b/src/applications/project/phid/PhabricatorProjectPHIDTypeProject.php
@@ -43,10 +43,11 @@
$name = $project->getName();
$id = $project->getID();
+ $slug = $project->getPrimarySlug();
$handle->setName($name);
- $handle->setObjectName('#'.rtrim($project->getPhrictionSlug(), '/'));
- $handle->setURI("/project/view/{$id}/");
+ $handle->setObjectName('#'.$slug);
+ $handle->setURI("/tag/{$slug}/");
$handle->setImageURI($project->getProfileImageURI());
if ($project->isArchived()) {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Mar 15, 7:46 AM (1 w, 12 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7686908
Default Alt Text
D9260.id21996.diff (2 KB)
Attached To
Mode
D9260: Project - use hashtag as a way to access project profile in URI, e.g. /project/hashtag/
Attached
Detach File
Event Timeline
Log In to Comment