From fefe5ae27c94c825936bcaaaa79c3f852d063ba4 Mon Sep 17 00:00:00 2001 From: Chad Little Date: Fri, 13 Jun 2014 14:09:21 -0700 Subject: [PATCH] Fix board links in TaskDetail Summary: Not sure if this is the correct fix, but I think it's where you intend to go? Test Plan: Click on link in Task, get the the correct board. Click lots of links of boards and make sure everything still works. Reviewers: epriestley Reviewed By: epriestley Subscribers: epriestley, Korvin Maniphest Tasks: T5361 Differential Revision: https://secure.phabricator.com/D9520 --- .../controller/ManiphestTaskDetailController.php | 8 +------- .../application/PhabricatorApplicationProject.php | 1 + .../PhabricatorProjectBoardViewController.php | 15 +++++++++++---- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/applications/maniphest/controller/ManiphestTaskDetailController.php b/src/applications/maniphest/controller/ManiphestTaskDetailController.php index 73bf6b54c9..0271e9f3a2 100644 --- a/src/applications/maniphest/controller/ManiphestTaskDetailController.php +++ b/src/applications/maniphest/controller/ManiphestTaskDetailController.php @@ -565,16 +565,10 @@ final class ManiphestTaskDetailController extends ManiphestController { $column = head(array_intersect_key($columns, $in_column_phids)); if ($column) { $column_name = pht('(%s)', $column->getDisplayName()); - // TODO: This is really hacky but there's no cleaner way to do it - // right now, T4022 should give us better tools for this. - $column_href = str_replace( - 'project/view', - 'project/board', - $handle->getURI()); $column_link = phutil_tag( 'a', array( - 'href' => $column_href, + 'href' => $handle->getURI().'board/', 'class' => 'maniphest-board-link', ), $column_name); diff --git a/src/applications/project/application/PhabricatorApplicationProject.php b/src/applications/project/application/PhabricatorApplicationProject.php index b2e441aeb5..de193b5837 100644 --- a/src/applications/project/application/PhabricatorApplicationProject.php +++ b/src/applications/project/application/PhabricatorApplicationProject.php @@ -79,6 +79,7 @@ final class PhabricatorApplicationProject extends PhabricatorApplication { ), '/tag/' => array( '(?P[^/]+)/' => 'PhabricatorProjectProfileController', + '(?P[^/]+)/board/' => 'PhabricatorProjectBoardViewController', ), ); } diff --git a/src/applications/project/controller/PhabricatorProjectBoardViewController.php b/src/applications/project/controller/PhabricatorProjectBoardViewController.php index f1c8c05704..b085428896 100644 --- a/src/applications/project/controller/PhabricatorProjectBoardViewController.php +++ b/src/applications/project/controller/PhabricatorProjectBoardViewController.php @@ -4,6 +4,7 @@ final class PhabricatorProjectBoardViewController extends PhabricatorProjectBoardController { private $id; + private $slug; private $handles; private $queryKey; private $filter; @@ -13,7 +14,8 @@ final class PhabricatorProjectBoardViewController } public function willProcessRequest(array $data) { - $this->id = $data['id']; + $this->id = idx($data, 'id'); + $this->slug = idx($data, 'slug'); $this->queryKey = idx($data, 'queryKey'); $this->filter = (bool)idx($data, 'filter'); } @@ -24,12 +26,17 @@ final class PhabricatorProjectBoardViewController $project = id(new PhabricatorProjectQuery()) ->setViewer($viewer) - ->needImages(true) - ->withIDs(array($this->id)) - ->executeOne(); + ->needImages(true); + if ($this->slug) { + $project->withSlugs(array($this->slug)); + } else { + $project->withIDs(array($this->id)); + } + $project = $project->executeOne(); if (!$project) { return new Aphront404Response(); } + $this->setProject($project); $columns = id(new PhabricatorProjectColumnQuery())