Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F13972672
D19550.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D19550.diff
View Options
diff --git a/src/applications/project/engine/PhabricatorProjectEditEngine.php b/src/applications/project/engine/PhabricatorProjectEditEngine.php
--- a/src/applications/project/engine/PhabricatorProjectEditEngine.php
+++ b/src/applications/project/engine/PhabricatorProjectEditEngine.php
@@ -51,7 +51,11 @@
}
protected function newEditableObject() {
- return PhabricatorProject::initializeNewProject($this->getViewer());
+ $parent = nonempty($this->parentProject, $this->milestoneProject);
+
+ return PhabricatorProject::initializeNewProject(
+ $this->getViewer(),
+ $parent);
}
protected function newObjectQuery() {
@@ -112,6 +116,7 @@
PhabricatorTransactions::TYPE_VIEW_POLICY,
PhabricatorTransactions::TYPE_EDIT_POLICY,
PhabricatorTransactions::TYPE_JOIN_POLICY,
+ PhabricatorTransactions::TYPE_SPACE,
PhabricatorProjectIconTransaction::TRANSACTIONTYPE,
PhabricatorProjectColorTransaction::TRANSACTIONTYPE,
);
diff --git a/src/applications/project/storage/PhabricatorProject.php b/src/applications/project/storage/PhabricatorProject.php
--- a/src/applications/project/storage/PhabricatorProject.php
+++ b/src/applications/project/storage/PhabricatorProject.php
@@ -61,7 +61,10 @@
const ITEM_MILESTONES = 'project.milestones';
const ITEM_SUBPROJECTS = 'project.subprojects';
- public static function initializeNewProject(PhabricatorUser $actor) {
+ public static function initializeNewProject(
+ PhabricatorUser $actor,
+ PhabricatorProject $parent = null) {
+
$app = id(new PhabricatorApplicationQuery())
->setViewer(PhabricatorUser::getOmnipotentUser())
->withClasses(array('PhabricatorProjectApplication'))
@@ -74,6 +77,14 @@
$join_policy = $app->getPolicy(
ProjectDefaultJoinCapability::CAPABILITY);
+ // If this is the child of some other project, default the Space to the
+ // Space of the parent.
+ if ($parent) {
+ $space_phid = $parent->getSpacePHID();
+ } else {
+ $space_phid = $actor->getDefaultSpacePHID();
+ }
+
$default_icon = PhabricatorProjectIconSet::getDefaultIconKey();
$default_color = PhabricatorProjectIconSet::getDefaultColorKey();
@@ -84,7 +95,7 @@
->setViewPolicy($view_policy)
->setEditPolicy($edit_policy)
->setJoinPolicy($join_policy)
- ->setSpacePHID($actor->getDefaultSpacePHID())
+ ->setSpacePHID($space_phid)
->setIsMembershipLocked(0)
->attachMemberPHIDs(array())
->attachSlugs(array())
@@ -704,6 +715,9 @@
public function getSpacePHID() {
+ if ($this->isMilestone()) {
+ return $this->getParentProject()->getSpacePHID();
+ }
return $this->spacePHID;
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Oct 18, 8:27 PM (3 w, 5 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6728599
Default Alt Text
D19550.diff (2 KB)
Attached To
Mode
D19550: Improve Space behavior for subprojects and milestones
Attached
Detach File
Event Timeline
Log In to Comment