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 @@ -6606,6 +6606,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 @@ -50,6 +50,7 @@ $v_description = $poll->getDescription(); $v_responses = $poll->getResponseVisibility(); $v_shuffle = $poll->getShuffle(); + $v_space = $poll->getSpacePHID(); $responses = $request->getArr('response'); if ($request->isFormPost()) { @@ -60,6 +61,8 @@ $v_view_policy = $request->getStr('viewPolicy'); $v_projects = $request->getArr('projects'); + $v_space = $request->getStr('spacePHID'); + if ($is_new) { $poll->setMethod($request->getInt('method')); } @@ -104,6 +107,10 @@ ->setTransactionType(PhabricatorTransactions::TYPE_VIEW_POLICY) ->setNewValue($v_view_policy); + $xactions[] = id(clone $template) + ->setTransactionType(PhabricatorTransactions::TYPE_SPACE) + ->setNewValue($v_space); + if (empty($errors)) { $proj_edge_type = PhabricatorProjectObjectHasProjectEdgeType::EDGECONST; $xactions[] = id(new PhabricatorSlowvoteTransaction()) @@ -250,7 +257,8 @@ ->setName('viewPolicy') ->setPolicyObject($poll) ->setPolicies($policies) - ->setCapability(PhabricatorPolicyCapability::CAN_VIEW)) + ->setCapability(PhabricatorPolicyCapability::CAN_VIEW) + ->setSpacePHID($v_space)) ->appendChild( id(new AphrontFormSubmitControl()) ->setValue($button) diff --git a/src/applications/slowvote/query/PhabricatorSlowvoteSearchEngine.php b/src/applications/slowvote/query/PhabricatorSlowvoteSearchEngine.php --- a/src/applications/slowvote/query/PhabricatorSlowvoteSearchEngine.php +++ b/src/applications/slowvote/query/PhabricatorSlowvoteSearchEngine.php @@ -147,6 +147,8 @@ } $item = id(new PHUIObjectItemView()) + ->setUser($viewer) + ->setObject($poll) ->setObjectName('V'.$poll->getID()) ->setHeader($poll->getQuestion()) ->setHref('/V'.$poll->getID()) 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; + } + }