Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15508770
D11272.id27110.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
15 KB
Referenced Files
None
Subscribers
None
D11272.id27110.diff
View Options
diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -2225,6 +2225,7 @@
'PhabricatorProjectTransactionQuery' => 'applications/project/query/PhabricatorProjectTransactionQuery.php',
'PhabricatorProjectUIEventListener' => 'applications/project/events/PhabricatorProjectUIEventListener.php',
'PhabricatorProjectUpdateController' => 'applications/project/controller/PhabricatorProjectUpdateController.php',
+ 'PhabricatorProjectViewController' => 'applications/project/controller/PhabricatorProjectViewController.php',
'PhabricatorProjectWatchController' => 'applications/project/controller/PhabricatorProjectWatchController.php',
'PhabricatorProjectWikiExplainController' => 'applications/project/controller/PhabricatorProjectWikiExplainController.php',
'PhabricatorProjectsPolicyRule' => 'applications/policy/rule/PhabricatorProjectsPolicyRule.php',
@@ -5445,6 +5446,7 @@
'PhabricatorProjectTransactionQuery' => 'PhabricatorApplicationTransactionQuery',
'PhabricatorProjectUIEventListener' => 'PhabricatorEventListener',
'PhabricatorProjectUpdateController' => 'PhabricatorProjectController',
+ 'PhabricatorProjectViewController' => 'PhabricatorProjectController',
'PhabricatorProjectWatchController' => 'PhabricatorProjectController',
'PhabricatorProjectWikiExplainController' => 'PhabricatorProjectController',
'PhabricatorProjectsPolicyRule' => 'PhabricatorPolicyRule',
diff --git a/src/applications/project/application/PhabricatorProjectApplication.php b/src/applications/project/application/PhabricatorProjectApplication.php
--- a/src/applications/project/application/PhabricatorProjectApplication.php
+++ b/src/applications/project/application/PhabricatorProjectApplication.php
@@ -52,8 +52,10 @@
=> 'PhabricatorProjectMembersEditController',
'members/(?P<id>[1-9]\d*)/remove/'
=> 'PhabricatorProjectMembersRemoveController',
- 'view/(?P<id>[1-9]\d*)/'
+ 'profile/(?P<id>[1-9]\d*)/'
=> 'PhabricatorProjectProfileController',
+ 'view/(?P<id>[1-9]\d*)/'
+ => 'PhabricatorProjectViewController',
'picture/(?P<id>[1-9]\d*)/'
=> 'PhabricatorProjectEditPictureController',
'icon/(?P<id>[1-9]\d*)/'
@@ -86,7 +88,7 @@
'wiki/' => 'PhabricatorProjectWikiExplainController',
),
'/tag/' => array(
- '(?P<slug>[^/]+)/' => 'PhabricatorProjectProfileController',
+ '(?P<slug>[^/]+)/' => 'PhabricatorProjectViewController',
'(?P<slug>[^/]+)/board/' => 'PhabricatorProjectBoardViewController',
),
);
diff --git a/src/applications/project/controller/PhabricatorProjectBoardController.php b/src/applications/project/controller/PhabricatorProjectBoardController.php
--- a/src/applications/project/controller/PhabricatorProjectBoardController.php
+++ b/src/applications/project/controller/PhabricatorProjectBoardController.php
@@ -18,7 +18,7 @@
$crumbs = parent::buildApplicationCrumbs();
$crumbs->addTextCrumb(
$project->getName(),
- $this->getApplicationURI('view/'.$project->getID().'/'));
+ $this->getApplicationURI('profile/'.$project->getID().'/'));
return $crumbs;
}
}
diff --git a/src/applications/project/controller/PhabricatorProjectBoardViewController.php b/src/applications/project/controller/PhabricatorProjectBoardViewController.php
--- a/src/applications/project/controller/PhabricatorProjectBoardViewController.php
+++ b/src/applications/project/controller/PhabricatorProjectBoardViewController.php
@@ -15,15 +15,7 @@
return true;
}
- public function willProcessRequest(array $data) {
- $this->id = idx($data, 'id');
- $this->slug = idx($data, 'slug');
- $this->queryKey = idx($data, 'queryKey');
- $this->filter = (bool)idx($data, 'filter');
- }
-
- public function processRequest() {
- $request = $this->getRequest();
+ public function handleRequest(AphrontRequest $request) {
$viewer = $request->getUser();
$show_hidden = $request->getBool('hidden');
@@ -32,10 +24,12 @@
$project = id(new PhabricatorProjectQuery())
->setViewer($viewer)
->needImages(true);
- if ($this->slug) {
- $project->withSlugs(array($this->slug));
+ $id = $request->getURIData('id');
+ $slug = $request->getURIData('slug');
+ if ($slug) {
+ $project->withSlugs(array($slug));
} else {
- $project->withIDs(array($this->id));
+ $project->withIDs(array($id));
}
$project = $project->executeOne();
if (!$project) {
@@ -111,7 +105,7 @@
$engine->getQueryResultsPageURI($saved->getQueryKey())));
}
- $query_key = $this->queryKey;
+ $query_key = $request->getURIData('queryKey');
if (!$query_key) {
$query_key = 'open';
}
@@ -133,7 +127,7 @@
$custom_query = $saved;
}
- if ($this->filter) {
+ if ($request->getURIData('filter')) {
$filter_form = id(new AphrontFormView())
->setUser($viewer);
$engine->buildSearchForm($filter_form, $saved);
@@ -303,7 +297,7 @@
$header_link = phutil_tag(
'a',
array(
- 'href' => $this->getApplicationURI('view/'.$project->getID().'/'),
+ 'href' => $this->getApplicationURI('profile/'.$project->getID().'/'),
),
$project->getName());
@@ -312,7 +306,7 @@
->setUser($viewer)
->setNoBackground(true)
->setImage($project->getProfileImageURI())
- ->setImageURL($this->getApplicationURI('view/'.$project->getID().'/'))
+ ->setImageURL($this->getApplicationURI('profile/'.$project->getID().'/'))
->addActionLink($sort_menu)
->addActionLink($filter_menu)
->addActionLink($manage_menu)
diff --git a/src/applications/project/controller/PhabricatorProjectEditDetailsController.php b/src/applications/project/controller/PhabricatorProjectEditDetailsController.php
--- a/src/applications/project/controller/PhabricatorProjectEditDetailsController.php
+++ b/src/applications/project/controller/PhabricatorProjectEditDetailsController.php
@@ -149,7 +149,7 @@
if ($is_new) {
$redirect_uri =
- $this->getApplicationURI('view/'.$project->getID().'/');
+ $this->getApplicationURI('profile/'.$project->getID().'/');
} else {
$redirect_uri =
$this->getApplicationURI('edit/'.$project->getID().'/');
@@ -306,7 +306,7 @@
} else {
$crumbs
->addTextCrumb($project->getName(),
- $this->getApplicationURI('view/'.$project->getID().'/'))
+ $this->getApplicationURI('profile/'.$project->getID().'/'))
->addTextCrumb(pht('Edit'),
$this->getApplicationURI('edit/'.$project->getID().'/'))
->addTextCrumb(pht('Details'));
diff --git a/src/applications/project/controller/PhabricatorProjectEditMainController.php b/src/applications/project/controller/PhabricatorProjectEditMainController.php
--- a/src/applications/project/controller/PhabricatorProjectEditMainController.php
+++ b/src/applications/project/controller/PhabricatorProjectEditMainController.php
@@ -46,7 +46,7 @@
$crumbs = $this->buildApplicationCrumbs();
$crumbs->addTextCrumb(
$project->getName(),
- $this->getApplicationURI('view/'.$project->getID().'/'));
+ $this->getApplicationURI('profile/'.$project->getID().'/'));
$crumbs->addTextCrumb(pht('Edit'));
$crumbs->setActionList($actions);
diff --git a/src/applications/project/controller/PhabricatorProjectEditPictureController.php b/src/applications/project/controller/PhabricatorProjectEditPictureController.php
--- a/src/applications/project/controller/PhabricatorProjectEditPictureController.php
+++ b/src/applications/project/controller/PhabricatorProjectEditPictureController.php
@@ -27,7 +27,7 @@
}
$edit_uri = $this->getApplicationURI('edit/'.$project->getID().'/');
- $view_uri = $this->getApplicationURI('view/'.$project->getID().'/');
+ $view_uri = $this->getApplicationURI('profile/'.$project->getID().'/');
$supported_formats = PhabricatorFile::getTransformableImageFormats();
$e_file = true;
diff --git a/src/applications/project/controller/PhabricatorProjectMembersEditController.php b/src/applications/project/controller/PhabricatorProjectMembersEditController.php
--- a/src/applications/project/controller/PhabricatorProjectMembersEditController.php
+++ b/src/applications/project/controller/PhabricatorProjectMembersEditController.php
@@ -75,6 +75,7 @@
$header_name = pht('Edit Members');
$title = pht('Edit Members');
+ $view_uri = $this->getApplicationURI('profile/'.$project->getID().'/');
$form = new AphrontFormView();
$form
@@ -86,7 +87,7 @@
->setDatasource(new PhabricatorPeopleDatasource()))
->appendChild(
id(new AphrontFormSubmitControl())
- ->addCancelButton('/project/view/'.$project->getID().'/')
+ ->addCancelButton($view_uri)
->setValue(pht('Add Members')));
$member_list = $this->renderMemberList($project, $handles);
@@ -96,10 +97,8 @@
->setForm($form);
$crumbs = $this->buildApplicationCrumbs($this->buildSideNavView())
- ->addTextCrumb(
- $project->getName(),
- '/project/view/'.$project->getID().'/')
- ->addTextCrumb(pht('Edit Members'), $this->getApplicationURI());
+ ->addTextCrumb($project->getName(), $view_uri)
+ ->addTextCrumb(pht('Edit Members'));
return $this->buildApplicationPage(
array(
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
@@ -3,22 +3,11 @@
final class PhabricatorProjectProfileController
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();
+ public function handleRequest(AphrontRequest $request) {
$user = $request->getUser();
$query = id(new PhabricatorProjectQuery())
@@ -27,16 +16,18 @@
->needWatchers(true)
->needImages(true)
->needSlugs(true);
- if ($this->slug) {
- $query->withSlugs(array($this->slug));
+ $id = $request->getURIData('id');
+ $slug = $request->getURIData('slug');
+ if ($slug) {
+ $query->withSlugs(array($slug));
} else {
- $query->withIDs(array($this->id));
+ $query->withIDs(array($id));
}
$project = $query->executeOne();
if (!$project) {
return new Aphront404Response();
}
- if ($this->slug && $this->slug != $project->getPrimarySlug()) {
+ if ($slug && $slug != $project->getPrimarySlug()) {
return id(new AphrontRedirectResponse())
->setURI('/tag/'.$project->getPrimarySlug().'/');
}
@@ -53,7 +44,7 @@
$project->getPHID(),
));
$query->setLimit(50);
- $query->setViewer($this->getRequest()->getUser());
+ $query->setViewer($request->getUser());
$stories = $query->execute();
$feed = $this->renderStories($stories);
diff --git a/src/applications/project/controller/PhabricatorProjectUpdateController.php b/src/applications/project/controller/PhabricatorProjectUpdateController.php
--- a/src/applications/project/controller/PhabricatorProjectUpdateController.php
+++ b/src/applications/project/controller/PhabricatorProjectUpdateController.php
@@ -42,7 +42,7 @@
return new Aphront404Response();
}
- $project_uri = '/project/view/'.$project->getID().'/';
+ $project_uri = $this->getApplicationURI('profile/'.$project->getID().'/');
if ($process_action) {
diff --git a/src/applications/project/controller/PhabricatorProjectViewController.php b/src/applications/project/controller/PhabricatorProjectViewController.php
new file mode 100644
--- /dev/null
+++ b/src/applications/project/controller/PhabricatorProjectViewController.php
@@ -0,0 +1,56 @@
+<?php
+
+final class PhabricatorProjectViewController
+ extends PhabricatorProjectController {
+
+ public function shouldAllowPublic() {
+ return true;
+ }
+
+ public function handleRequest(AphrontRequest $request) {
+ $request = $this->getRequest();
+ $user = $request->getUser();
+
+ $query = id(new PhabricatorProjectQuery())
+ ->setViewer($user)
+ ->needMembers(true)
+ ->needWatchers(true)
+ ->needImages(true)
+ ->needSlugs(true);
+ $id = $request->getURIData('id');
+ $slug = $request->getURIData('slug');
+ if ($slug) {
+ $query->withSlugs(array($slug));
+ } else {
+ $query->withIDs(array($id));
+ }
+ $project = $query->executeOne();
+ if (!$project) {
+ return new Aphront404Response();
+ }
+
+
+ $columns = id(new PhabricatorProjectColumnQuery())
+ ->setViewer($user)
+ ->withProjectPHIDs(array($project->getPHID()))
+ ->execute();
+ if ($columns) {
+ $controller = 'board';
+ } else {
+ $controller = 'profile';
+ }
+
+ switch ($controller) {
+ case 'board':
+ $controller_object = new PhabricatorProjectBoardViewController();
+ break;
+ case 'profile':
+ default:
+ $controller_object = new PhabricatorProjectProfileController();
+ break;
+ }
+
+ return $this->delegateToController($controller_object);
+ }
+
+}
diff --git a/src/applications/project/controller/PhabricatorProjectWatchController.php b/src/applications/project/controller/PhabricatorProjectWatchController.php
--- a/src/applications/project/controller/PhabricatorProjectWatchController.php
+++ b/src/applications/project/controller/PhabricatorProjectWatchController.php
@@ -25,7 +25,7 @@
return new Aphront404Response();
}
- $project_uri = '/project/view/'.$project->getID().'/';
+ $project_uri = $this->getApplicationURI('profile/'.$project->getID().'/');
// You must be a member of a project to
if (!$project->isUserMember($viewer->getPHID())) {
diff --git a/src/applications/project/query/PhabricatorProjectSearchEngine.php b/src/applications/project/query/PhabricatorProjectSearchEngine.php
--- a/src/applications/project/query/PhabricatorProjectSearchEngine.php
+++ b/src/applications/project/query/PhabricatorProjectSearchEngine.php
@@ -219,8 +219,15 @@
foreach ($projects as $key => $project) {
$id = $project->getID();
+ $profile_uri = $this->getApplicationURI("profile/{$id}/");
$workboards_uri = $this->getApplicationURI("board/{$id}/");
$members_uri = $this->getApplicationURI("members/{$id}/");
+ $profile_url = phutil_tag(
+ 'a',
+ array(
+ 'href' => $profile_uri,
+ ),
+ pht('Profile'));
$workboards_url = phutil_tag(
'a',
array(
@@ -252,6 +259,7 @@
->setHref($this->getApplicationURI("view/{$id}/"))
->setImageURI($project->getProfileImageURI())
->addAttribute($tag_list)
+ ->addAttribute($profile_url)
->addAttribute($workboards_url)
->addAttribute($members_url);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Apr 17, 6:25 AM (5 d, 22 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7704851
Default Alt Text
D11272.id27110.diff (15 KB)
Attached To
Mode
D11272: Revamp Projects with new navigation
Attached
Detach File
Event Timeline
Log In to Comment