From 13cac5c362bba4e69f3c1f820a920bd5a62ad602 Mon Sep 17 00:00:00 2001 From: epriestley Date: Mon, 30 Jul 2018 15:32:55 -0700 Subject: [PATCH] Add Spaces to Projects Summary: See PHI774. Ref T13164. There is no reason projects //don't// support Spaces, just a vague concern that it's not hugely useful and might be a bit confusing. However, it's at least somewhat useful (to improve consistency and reduce special casing) and doesn't necessarily seem more confusing than Projects are anyway. Support is trivial from a technical point of view, so just hook it up. Test Plan: Created new projects, shifted projects between spaces. The support is all pretty much automatic. Reviewers: amckinley Reviewed By: amckinley Subscribers: PHID-OPKG-gm6ozazyms6q6i22gyam Maniphest Tasks: T13164 Differential Revision: https://secure.phabricator.com/D19549 --- .../sql/autopatches/20180730.project.01.spaces.sql | 2 ++ src/__phutil_library_map__.php | 1 + .../project/storage/PhabricatorProject.php | 13 ++++++++++++- 3 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 resources/sql/autopatches/20180730.project.01.spaces.sql diff --git a/resources/sql/autopatches/20180730.project.01.spaces.sql b/resources/sql/autopatches/20180730.project.01.spaces.sql new file mode 100644 index 0000000000..927ff3b677 --- /dev/null +++ b/resources/sql/autopatches/20180730.project.01.spaces.sql @@ -0,0 +1,2 @@ +ALTER TABLE {$NAMESPACE}_project.project + ADD COLUMN spacePHID VARBINARY(64) DEFAULT NULL; diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 568c715ea1..981764dc7a 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -9752,6 +9752,7 @@ phutil_register_library_map(array( 'PhabricatorFerretInterface', 'PhabricatorConduitResultInterface', 'PhabricatorColumnProxyInterface', + 'PhabricatorSpacesInterface', ), 'PhabricatorProjectAddHeraldAction' => 'PhabricatorProjectHeraldAction', 'PhabricatorProjectApplication' => 'PhabricatorApplication', diff --git a/src/applications/project/storage/PhabricatorProject.php b/src/applications/project/storage/PhabricatorProject.php index 4ec4b63675..aa035aedf5 100644 --- a/src/applications/project/storage/PhabricatorProject.php +++ b/src/applications/project/storage/PhabricatorProject.php @@ -11,7 +11,8 @@ final class PhabricatorProject extends PhabricatorProjectDAO PhabricatorFulltextInterface, PhabricatorFerretInterface, PhabricatorConduitResultInterface, - PhabricatorColumnProxyInterface { + PhabricatorColumnProxyInterface, + PhabricatorSpacesInterface { protected $name; protected $status = PhabricatorProjectStatus::STATUS_ACTIVE; @@ -38,6 +39,7 @@ final class PhabricatorProject extends PhabricatorProjectDAO protected $projectPathKey; protected $properties = array(); + protected $spacePHID; private $memberPHIDs = self::ATTACHABLE; private $watcherPHIDs = self::ATTACHABLE; @@ -82,6 +84,7 @@ final class PhabricatorProject extends PhabricatorProjectDAO ->setViewPolicy($view_policy) ->setEditPolicy($edit_policy) ->setJoinPolicy($join_policy) + ->setSpacePHID($actor->getDefaultSpacePHID()) ->setIsMembershipLocked(0) ->attachMemberPHIDs(array()) ->attachSlugs(array()) @@ -697,6 +700,14 @@ final class PhabricatorProject extends PhabricatorProjectDAO } +/* -( PhabricatorSpacesInterface )----------------------------------------- */ + + + public function getSpacePHID() { + return $this->spacePHID; + } + + /* -( PhabricatorDestructibleInterface )----------------------------------- */