1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-20 12:30:56 +01:00

Make Project Mobile menu more resilient

Summary: This sets $project at the controller level so it's available to building the icon nav and mobile menu, instead of guessing the $id. Fixes T7289

Test Plan: Test a project and its mobile menu when it does and does not have a workboard initialized. Also tested coming in via a slug and an id.

Reviewers: epriestley, btrahan

Reviewed By: btrahan

Subscribers: Korvin, epriestley

Maniphest Tasks: T7289

Differential Revision: https://secure.phabricator.com/D11848
This commit is contained in:
Chad Little 2015-02-23 11:27:19 -08:00
parent 7d4ec48a0e
commit b070ed5019
2 changed files with 17 additions and 14 deletions

View file

@ -3,16 +3,6 @@
abstract class PhabricatorProjectBoardController abstract class PhabricatorProjectBoardController
extends PhabricatorProjectController { extends PhabricatorProjectController {
private $project;
protected function setProject(PhabricatorProject $project) {
$this->project = $project;
return $this;
}
protected function getProject() {
return $this->project;
}
public function buildIconNavView(PhabricatorProject $project) { public function buildIconNavView(PhabricatorProject $project) {
$id = $project->getID(); $id = $project->getID();
$nav = parent::buildIconNavView($project); $nav = parent::buildIconNavView($project);

View file

@ -2,20 +2,32 @@
abstract class PhabricatorProjectController extends PhabricatorController { abstract class PhabricatorProjectController extends PhabricatorController {
private $project;
protected function setProject(PhabricatorProject $project) {
$this->project = $project;
return $this;
}
protected function getProject() {
return $this->project;
}
public function buildApplicationMenu() { public function buildApplicationMenu() {
return $this->buildSideNavView(true)->getMenu(); return $this->buildSideNavView(true)->getMenu();
} }
public function buildSideNavView($for_app = false) { public function buildSideNavView($for_app = false) {
$viewer = $this->getViewer(); $project = $this->getProject();
$nav = new AphrontSideNavFilterView(); $nav = new AphrontSideNavFilterView();
$nav->setBaseURI(new PhutilURI($this->getApplicationURI())); $nav->setBaseURI(new PhutilURI($this->getApplicationURI()));
$id = null; $viewer = $this->getViewer();
if ($for_app) { if ($for_app) {
$id = $this->getRequest()->getURIData('id'); if ($project) {
if ($id) { $id = $project->getID();
$nav->addFilter("profile/{$id}/", pht('Profile')); $nav->addFilter("profile/{$id}/", pht('Profile'));
$nav->addFilter("board/{$id}/", pht('Workboard')); $nav->addFilter("board/{$id}/", pht('Workboard'));
$nav->addFilter("members/{$id}/", pht('Members')); $nav->addFilter("members/{$id}/", pht('Members'));
@ -37,6 +49,7 @@ abstract class PhabricatorProjectController extends PhabricatorController {
} }
public function buildIconNavView(PhabricatorProject $project) { public function buildIconNavView(PhabricatorProject $project) {
$this->setProject($project);
$viewer = $this->getViewer(); $viewer = $this->getViewer();
$id = $project->getID(); $id = $project->getID();
$picture = $project->getProfileImageURI(); $picture = $project->getProfileImageURI();