Skip to content

Commit 389e4d1

Browse files
author
epriestley
committed
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
1 parent 972788b commit 389e4d1

File tree

4 files changed

+30
-5
lines changed

4 files changed

+30
-5
lines changed

src/applications/project/engine/PhabricatorProjectEditEngine.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,8 @@ protected function willConfigureFields($object, array $fields) {
109109
PhabricatorTransactions::TYPE_VIEW_POLICY,
110110
PhabricatorTransactions::TYPE_EDIT_POLICY,
111111
PhabricatorTransactions::TYPE_JOIN_POLICY,
112+
PhabricatorProjectTransaction::TYPE_ICON,
113+
PhabricatorProjectTransaction::TYPE_COLOR,
112114
);
113115
$unavailable = array_fuse($unavailable);
114116

src/applications/project/phid/PhabricatorProjectProjectPHIDType.php

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,17 @@ public function loadHandles(
4242
$slug = $project->getPrimarySlug();
4343

4444
$handle->setName($name);
45-
$handle->setObjectName('#'.$slug);
46-
$handle->setURI("/tag/{$slug}/");
45+
46+
if (strlen($slug)) {
47+
$handle->setObjectName('#'.$slug);
48+
$handle->setURI("/tag/{$slug}/");
49+
} else {
50+
$handle->setURI("/project/view/{$id}/");
51+
}
52+
4753
$handle->setImageURI($project->getProfileImageURI());
48-
$handle->setIcon($project->getIcon());
49-
$handle->setTagColor($project->getColor());
54+
$handle->setIcon($project->getDisplayIcon());
55+
$handle->setTagColor($project->getDisplayColor());
5056

5157
if ($project->isArchived()) {
5258
$handle->setStatus(PhabricatorObjectHandle::STATUS_CLOSED);

src/applications/project/query/PhabricatorProjectSearchEngine.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ public function getApplicationClassName() {
1313

1414
public function newQuery() {
1515
return id(new PhabricatorProjectQuery())
16-
->needImages(true);
16+
->needImages(true)
17+
->withIsMilestone(false);
1718
}
1819

1920
protected function buildCustomSearchFields() {

src/applications/project/storage/PhabricatorProject.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -484,6 +484,22 @@ public function loadNextMilestoneNumber() {
484484
return $number;
485485
}
486486

487+
public function getDisplayIcon() {
488+
if ($this->isMilestone()) {
489+
return 'fa-map-marker';
490+
}
491+
492+
return $this->getIcon();
493+
}
494+
495+
public function getDisplayColor() {
496+
if ($this->isMilestone()) {
497+
return self::DEFAULT_COLOR;
498+
}
499+
500+
return $this->getColor();
501+
}
502+
487503

488504
/* -( PhabricatorSubscribableInterface )----------------------------------- */
489505

0 commit comments

Comments
 (0)