From 389e4d1b1fa0a0baab4ad9e4c2451e9d0d2cc4e4 Mon Sep 17 00:00:00 2001 From: epriestley Date: Wed, 30 Dec 2015 03:35:51 -0800 Subject: [PATCH] Lock milestone projects to an automatic color/icon Summary: Ref T10010. Currently, milestone subproject have editable icons/colors, but I don't think this is likely to be used much (the expectation is that milestones will be common and homogenous, and it doesn't make much sense to pick different icons for "Sprint 32" vs "Sprint 33", I think). Locking the icon and color lets us simplify the form, make milestones more distinct, and potentially reuse the color later for other things (e.g., active/future/past or on time / overdue or whatever else) or just give them a special color to make them more visible. The best argument for retaining this that I can come up with is that certain milestones may be special (e.g., Sprint 19 is a major release?), but you can just name it "Sprint 19 (v3.0!)" or something, which seems pretty good for now. Also don't show milestones on task browse/list view. Test Plan: {F1048532} Reviewers: chad Reviewed By: chad Maniphest Tasks: T10010 Differential Revision: https://secure.phabricator.com/D14912 --- .../engine/PhabricatorProjectEditEngine.php | 2 ++ .../phid/PhabricatorProjectProjectPHIDType.php | 14 ++++++++++---- .../query/PhabricatorProjectSearchEngine.php | 3 ++- .../project/storage/PhabricatorProject.php | 16 ++++++++++++++++ 4 files changed, 30 insertions(+), 5 deletions(-) diff --git a/src/applications/project/engine/PhabricatorProjectEditEngine.php b/src/applications/project/engine/PhabricatorProjectEditEngine.php index 9f72ad8147..389c585fce 100644 --- a/src/applications/project/engine/PhabricatorProjectEditEngine.php +++ b/src/applications/project/engine/PhabricatorProjectEditEngine.php @@ -109,6 +109,8 @@ final class PhabricatorProjectEditEngine PhabricatorTransactions::TYPE_VIEW_POLICY, PhabricatorTransactions::TYPE_EDIT_POLICY, PhabricatorTransactions::TYPE_JOIN_POLICY, + PhabricatorProjectTransaction::TYPE_ICON, + PhabricatorProjectTransaction::TYPE_COLOR, ); $unavailable = array_fuse($unavailable); diff --git a/src/applications/project/phid/PhabricatorProjectProjectPHIDType.php b/src/applications/project/phid/PhabricatorProjectProjectPHIDType.php index c3d9bdd3fb..eb1a59a5f5 100644 --- a/src/applications/project/phid/PhabricatorProjectProjectPHIDType.php +++ b/src/applications/project/phid/PhabricatorProjectProjectPHIDType.php @@ -42,11 +42,17 @@ final class PhabricatorProjectProjectPHIDType extends PhabricatorPHIDType { $slug = $project->getPrimarySlug(); $handle->setName($name); - $handle->setObjectName('#'.$slug); - $handle->setURI("/tag/{$slug}/"); + + if (strlen($slug)) { + $handle->setObjectName('#'.$slug); + $handle->setURI("/tag/{$slug}/"); + } else { + $handle->setURI("/project/view/{$id}/"); + } + $handle->setImageURI($project->getProfileImageURI()); - $handle->setIcon($project->getIcon()); - $handle->setTagColor($project->getColor()); + $handle->setIcon($project->getDisplayIcon()); + $handle->setTagColor($project->getDisplayColor()); if ($project->isArchived()) { $handle->setStatus(PhabricatorObjectHandle::STATUS_CLOSED); diff --git a/src/applications/project/query/PhabricatorProjectSearchEngine.php b/src/applications/project/query/PhabricatorProjectSearchEngine.php index 66933ac81a..0c3af4a8e6 100644 --- a/src/applications/project/query/PhabricatorProjectSearchEngine.php +++ b/src/applications/project/query/PhabricatorProjectSearchEngine.php @@ -13,7 +13,8 @@ final class PhabricatorProjectSearchEngine public function newQuery() { return id(new PhabricatorProjectQuery()) - ->needImages(true); + ->needImages(true) + ->withIsMilestone(false); } protected function buildCustomSearchFields() { diff --git a/src/applications/project/storage/PhabricatorProject.php b/src/applications/project/storage/PhabricatorProject.php index 7e31bfa1f2..5d2aa3461e 100644 --- a/src/applications/project/storage/PhabricatorProject.php +++ b/src/applications/project/storage/PhabricatorProject.php @@ -484,6 +484,22 @@ final class PhabricatorProject extends PhabricatorProjectDAO return $number; } + public function getDisplayIcon() { + if ($this->isMilestone()) { + return 'fa-map-marker'; + } + + return $this->getIcon(); + } + + public function getDisplayColor() { + if ($this->isMilestone()) { + return self::DEFAULT_COLOR; + } + + return $this->getColor(); + } + /* -( PhabricatorSubscribableInterface )----------------------------------- */