diff --git a/resources/sql/autopatches/20150702.spaces.1.slowvote.sql b/resources/sql/autopatches/20150702.spaces.1.slowvote.sql new file mode 100644 --- /dev/null +++ b/resources/sql/autopatches/20150702.spaces.1.slowvote.sql @@ -0,0 +1,2 @@ +ALTER TABLE {$NAMESPACE}_slowvote.slowvote_poll +ADD spacePHID varbinary(64); diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -6413,6 +6413,7 @@ 'PhabricatorTokenReceiverInterface', 'PhabricatorProjectInterface', 'PhabricatorDestructibleInterface', + 'PhabricatorSpacesInterface', ), 'PhabricatorSlowvotePollController' => 'PhabricatorSlowvoteController', 'PhabricatorSlowvotePollPHIDType' => 'PhabricatorPHIDType', diff --git a/src/applications/slowvote/controller/PhabricatorSlowvoteEditController.php b/src/applications/slowvote/controller/PhabricatorSlowvoteEditController.php --- a/src/applications/slowvote/controller/PhabricatorSlowvoteEditController.php +++ b/src/applications/slowvote/controller/PhabricatorSlowvoteEditController.php @@ -46,6 +46,8 @@ $e_response = true; $errors = array(); + $space = $poll->getSpacePHID(); + $v_question = $poll->getQuestion(); $v_description = $poll->getDescription(); $v_responses = $poll->getResponseVisibility(); @@ -60,6 +62,8 @@ $v_view_policy = $request->getStr('viewPolicy'); $v_projects = $request->getArr('projects'); + $space = $request->getStr('spacePHID'); + if ($is_new) { $poll->setMethod($request->getInt('method')); } @@ -104,6 +108,10 @@ ->setTransactionType(PhabricatorTransactions::TYPE_VIEW_POLICY) ->setNewValue($v_view_policy); + $xactions[] = id(clone $template) + ->setTransactionType(PhabricatorTransactions::TYPE_SPACE) + ->setNewValue($space); + if (empty($errors)) { $proj_edge_type = PhabricatorProjectObjectHasProjectEdgeType::EDGECONST; $xactions[] = id(new PhabricatorSlowvoteTransaction()) diff --git a/src/applications/slowvote/storage/PhabricatorSlowvotePoll.php b/src/applications/slowvote/storage/PhabricatorSlowvotePoll.php --- a/src/applications/slowvote/storage/PhabricatorSlowvotePoll.php +++ b/src/applications/slowvote/storage/PhabricatorSlowvotePoll.php @@ -8,7 +8,8 @@ PhabricatorFlaggableInterface, PhabricatorTokenReceiverInterface, PhabricatorProjectInterface, - PhabricatorDestructibleInterface { + PhabricatorDestructibleInterface, + PhabricatorSpacesInterface { const RESPONSES_VISIBLE = 0; const RESPONSES_VOTERS = 1; @@ -25,6 +26,7 @@ protected $method; protected $viewPolicy; protected $isClosed = 0; + protected $spacePHID; private $options = self::ATTACHABLE; private $choices = self::ATTACHABLE; @@ -41,7 +43,8 @@ return id(new PhabricatorSlowvotePoll()) ->setAuthorPHID($actor->getPHID()) - ->setViewPolicy($view_policy); + ->setViewPolicy($view_policy) + ->setSpacePHID($actor->getDefaultSpacePHID()); } protected function getConfiguration() { @@ -201,4 +204,10 @@ $this->saveTransaction(); } + /* -( PhabricatorSpacesInterface )----------------------------------------- */ + + public function getSpacePHID() { + return $this->spacePHID; + } + }