mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-18 11:30:55 +01:00
Implements Spaces application in Slowvote
Summary: Implements T8733 Test Plan: Verify that spaces policies can be implemented in the creation and editing of polls. Reviewers: lpriestley, epriestley, #blessed_reviewers Reviewed By: epriestley, #blessed_reviewers Subscribers: epriestley, Korvin Differential Revision: https://secure.phabricator.com/D13537
This commit is contained in:
parent
bb54957d96
commit
a40437a531
5 changed files with 25 additions and 3 deletions
2
resources/sql/autopatches/20150702.spaces.1.slowvote.sql
Normal file
2
resources/sql/autopatches/20150702.spaces.1.slowvote.sql
Normal file
|
@ -0,0 +1,2 @@
|
|||
ALTER TABLE {$NAMESPACE}_slowvote.slowvote_poll
|
||||
ADD spacePHID varbinary(64);
|
|
@ -6606,6 +6606,7 @@ phutil_register_library_map(array(
|
|||
'PhabricatorTokenReceiverInterface',
|
||||
'PhabricatorProjectInterface',
|
||||
'PhabricatorDestructibleInterface',
|
||||
'PhabricatorSpacesInterface',
|
||||
),
|
||||
'PhabricatorSlowvotePollController' => 'PhabricatorSlowvoteController',
|
||||
'PhabricatorSlowvotePollPHIDType' => 'PhabricatorPHIDType',
|
||||
|
|
|
@ -50,6 +50,7 @@ final class PhabricatorSlowvoteEditController
|
|||
$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 @@ final class PhabricatorSlowvoteEditController
|
|||
$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 @@ final class PhabricatorSlowvoteEditController
|
|||
->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 @@ final class PhabricatorSlowvoteEditController
|
|||
->setName('viewPolicy')
|
||||
->setPolicyObject($poll)
|
||||
->setPolicies($policies)
|
||||
->setCapability(PhabricatorPolicyCapability::CAN_VIEW))
|
||||
->setCapability(PhabricatorPolicyCapability::CAN_VIEW)
|
||||
->setSpacePHID($v_space))
|
||||
->appendChild(
|
||||
id(new AphrontFormSubmitControl())
|
||||
->setValue($button)
|
||||
|
|
|
@ -147,6 +147,8 @@ final class PhabricatorSlowvoteSearchEngine
|
|||
}
|
||||
|
||||
$item = id(new PHUIObjectItemView())
|
||||
->setUser($viewer)
|
||||
->setObject($poll)
|
||||
->setObjectName('V'.$poll->getID())
|
||||
->setHeader($poll->getQuestion())
|
||||
->setHref('/V'.$poll->getID())
|
||||
|
|
|
@ -8,7 +8,8 @@ final class PhabricatorSlowvotePoll extends PhabricatorSlowvoteDAO
|
|||
PhabricatorFlaggableInterface,
|
||||
PhabricatorTokenReceiverInterface,
|
||||
PhabricatorProjectInterface,
|
||||
PhabricatorDestructibleInterface {
|
||||
PhabricatorDestructibleInterface,
|
||||
PhabricatorSpacesInterface {
|
||||
|
||||
const RESPONSES_VISIBLE = 0;
|
||||
const RESPONSES_VOTERS = 1;
|
||||
|
@ -25,6 +26,7 @@ final class PhabricatorSlowvotePoll extends PhabricatorSlowvoteDAO
|
|||
protected $method;
|
||||
protected $viewPolicy;
|
||||
protected $isClosed = 0;
|
||||
protected $spacePHID;
|
||||
|
||||
private $options = self::ATTACHABLE;
|
||||
private $choices = self::ATTACHABLE;
|
||||
|
@ -41,7 +43,8 @@ final class PhabricatorSlowvotePoll extends PhabricatorSlowvoteDAO
|
|||
|
||||
return id(new PhabricatorSlowvotePoll())
|
||||
->setAuthorPHID($actor->getPHID())
|
||||
->setViewPolicy($view_policy);
|
||||
->setViewPolicy($view_policy)
|
||||
->setSpacePHID($actor->getDefaultSpacePHID());
|
||||
}
|
||||
|
||||
protected function getConfiguration() {
|
||||
|
@ -201,4 +204,10 @@ final class PhabricatorSlowvotePoll extends PhabricatorSlowvoteDAO
|
|||
$this->saveTransaction();
|
||||
}
|
||||
|
||||
/* -( PhabricatorSpacesInterface )--------------------------------------- */
|
||||
|
||||
public function getSpacePHID() {
|
||||
return $this->spacePHID;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue