@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.

Improve Space behavior for subprojects and milestones

Summary:
Depends on D19549. Ref T13164. See PHI774.

- Make milestones inherit their parent project's space automatically, like they inherit their parent policies.
- Make subprojects default to their parent project's space.

Test Plan: Created subprojects and milestones, got sensible default/effective Space behavior.

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T13164

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

+22 -3
+6 -1
src/applications/project/engine/PhabricatorProjectEditEngine.php
··· 51 51 } 52 52 53 53 protected function newEditableObject() { 54 - return PhabricatorProject::initializeNewProject($this->getViewer()); 54 + $parent = nonempty($this->parentProject, $this->milestoneProject); 55 + 56 + return PhabricatorProject::initializeNewProject( 57 + $this->getViewer(), 58 + $parent); 55 59 } 56 60 57 61 protected function newObjectQuery() { ··· 112 116 PhabricatorTransactions::TYPE_VIEW_POLICY, 113 117 PhabricatorTransactions::TYPE_EDIT_POLICY, 114 118 PhabricatorTransactions::TYPE_JOIN_POLICY, 119 + PhabricatorTransactions::TYPE_SPACE, 115 120 PhabricatorProjectIconTransaction::TRANSACTIONTYPE, 116 121 PhabricatorProjectColorTransaction::TRANSACTIONTYPE, 117 122 );
+16 -2
src/applications/project/storage/PhabricatorProject.php
··· 61 61 const ITEM_MILESTONES = 'project.milestones'; 62 62 const ITEM_SUBPROJECTS = 'project.subprojects'; 63 63 64 - public static function initializeNewProject(PhabricatorUser $actor) { 64 + public static function initializeNewProject( 65 + PhabricatorUser $actor, 66 + PhabricatorProject $parent = null) { 67 + 65 68 $app = id(new PhabricatorApplicationQuery()) 66 69 ->setViewer(PhabricatorUser::getOmnipotentUser()) 67 70 ->withClasses(array('PhabricatorProjectApplication')) ··· 74 77 $join_policy = $app->getPolicy( 75 78 ProjectDefaultJoinCapability::CAPABILITY); 76 79 80 + // If this is the child of some other project, default the Space to the 81 + // Space of the parent. 82 + if ($parent) { 83 + $space_phid = $parent->getSpacePHID(); 84 + } else { 85 + $space_phid = $actor->getDefaultSpacePHID(); 86 + } 87 + 77 88 $default_icon = PhabricatorProjectIconSet::getDefaultIconKey(); 78 89 $default_color = PhabricatorProjectIconSet::getDefaultColorKey(); 79 90 ··· 84 95 ->setViewPolicy($view_policy) 85 96 ->setEditPolicy($edit_policy) 86 97 ->setJoinPolicy($join_policy) 87 - ->setSpacePHID($actor->getDefaultSpacePHID()) 98 + ->setSpacePHID($space_phid) 88 99 ->setIsMembershipLocked(0) 89 100 ->attachMemberPHIDs(array()) 90 101 ->attachSlugs(array()) ··· 704 715 705 716 706 717 public function getSpacePHID() { 718 + if ($this->isMilestone()) { 719 + return $this->getParentProject()->getSpacePHID(); 720 + } 707 721 return $this->spacePHID; 708 722 } 709 723