@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Don't autoname milestones, but do show the previous milestone name as a hint

Summary: Fixes T10347. In the long run maybe we'll try to guess this better, but for now get rid of the "Milestone X" hardcode and just show what the last one was called.

Test Plan:
- Created the first milestone for a project.
- Created the nth milestone for a project.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T10347

Differential Revision: https://secure.phabricator.com/D15262

+64 -12
+28 -11
src/applications/project/engine/PhabricatorProjectEditEngine.php
··· 43 43 } 44 44 45 45 protected function newEditableObject() { 46 - $project = PhabricatorProject::initializeNewProject($this->getViewer()); 47 - 48 - $milestone = $this->getMilestoneProject(); 49 - if ($milestone) { 50 - $default_name = pht( 51 - 'Milestone %s', 52 - new PhutilNumber($milestone->loadNextMilestoneNumber())); 53 - $project->setName($default_name); 54 - } 55 - 56 - return $project; 46 + return PhabricatorProject::initializeNewProject($this->getViewer()); 57 47 } 58 48 59 49 protected function newObjectQuery() { ··· 139 129 array( 140 130 'parent', 141 131 'milestone', 132 + 'milestone.previous', 142 133 'name', 143 134 'std:project:internal:description', 144 135 'icon', ··· 166 157 $parent_phid = null; 167 158 } 168 159 160 + $previous_milestone_phid = null; 169 161 if ($milestone) { 170 162 $milestone_phid = $milestone->getPHID(); 163 + 164 + // Load the current milestone so we can show the user a hint about what 165 + // it was called, so they don't have to remember if the next one should 166 + // be "Sprint 287" or "Sprint 278". 167 + 168 + $number = ($milestone->loadNextMilestoneNumber() - 1); 169 + if ($number > 0) { 170 + $previous_milestone = id(new PhabricatorProjectQuery()) 171 + ->setViewer($this->getViewer()) 172 + ->withParentProjectPHIDs(array($milestone->getPHID())) 173 + ->withIsMilestone(true) 174 + ->withMilestoneNumberBetween($number, $number) 175 + ->executeOne(); 176 + if ($previous_milestone) { 177 + $previous_milestone_phid = $previous_milestone->getPHID(); 178 + } 179 + } 171 180 } else { 172 181 $milestone_phid = null; 173 182 } ··· 199 208 ->setTransactionType(PhabricatorProjectTransaction::TYPE_MILESTONE) 200 209 ->setHandleParameterType(new AphrontPHIDHTTPParameterType()) 201 210 ->setSingleValue($milestone_phid) 211 + ->setIsReorderable(false) 212 + ->setIsDefaultable(false) 213 + ->setIsLockable(false) 214 + ->setIsLocked(true), 215 + id(new PhabricatorHandlesEditField()) 216 + ->setKey('milestone.previous') 217 + ->setLabel(pht('Previous Milestone')) 218 + ->setSingleValue($previous_milestone_phid) 202 219 ->setIsReorderable(false) 203 220 ->setIsDefaultable(false) 204 221 ->setIsLockable(false)
+23
src/applications/project/query/PhabricatorProjectQuery.php
··· 20 20 private $hasSubprojects; 21 21 private $minDepth; 22 22 private $maxDepth; 23 + private $minMilestoneNumber; 24 + private $maxMilestoneNumber; 23 25 24 26 private $status = 'status-any'; 25 27 const STATUS_ANY = 'status-any'; ··· 108 110 public function withDepthBetween($min, $max) { 109 111 $this->minDepth = $min; 110 112 $this->maxDepth = $max; 113 + return $this; 114 + } 115 + 116 + public function withMilestoneNumberBetween($min, $max) { 117 + $this->minMilestoneNumber = $min; 118 + $this->maxMilestoneNumber = $max; 111 119 return $this; 112 120 } 113 121 ··· 494 502 } 495 503 } 496 504 505 + 497 506 if ($this->hasSubprojects !== null) { 498 507 $where[] = qsprintf( 499 508 $conn, ··· 513 522 $conn, 514 523 'projectDepth <= %d', 515 524 $this->maxDepth); 525 + } 526 + 527 + if ($this->minMilestoneNumber !== null) { 528 + $where[] = qsprintf( 529 + $conn, 530 + 'milestoneNumber >= %d', 531 + $this->minMilestoneNumber); 532 + } 533 + 534 + if ($this->maxMilestoneNumber !== null) { 535 + $where[] = qsprintf( 536 + $conn, 537 + 'milestoneNumber <= %d', 538 + $this->maxMilestoneNumber); 516 539 } 517 540 518 541 return $where;
+13 -1
src/applications/transactions/storage/PhabricatorEditEngineConfiguration.php
··· 175 175 } 176 176 177 177 private function reorderFields(array $fields) { 178 + // Fields which can not be reordered are fixed in order at the top of the 179 + // form. These are used to show instructions or contextual information. 180 + 181 + $fixed = array(); 182 + foreach ($fields as $key => $field) { 183 + if (!$field->getIsReorderable()) { 184 + $fixed[$key] = $field; 185 + } 186 + } 187 + 178 188 $keys = $this->getFieldOrder(); 179 - $fields = array_select_keys($fields, $keys) + $fields; 189 + 190 + $fields = $fixed + array_select_keys($fields, $keys) + $fields; 191 + 180 192 return $fields; 181 193 } 182 194