Add Spaces to Ponder
Summary: Ref T8493, Ref T3578. Adds spaces support to ponder. Test Plan: Ask a question in a new space, see new question. Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin Maniphest Tasks: T3578, T8493 Differential Revision: https://secure.phabricator.com/D13792
This commit is contained in:
2
resources/sql/autopatches/20150804.ponder.spaces.4.sql
Normal file
2
resources/sql/autopatches/20150804.ponder.spaces.4.sql
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
ALTER TABLE {$NAMESPACE}_ponder.ponder_question
|
||||||
|
ADD spacePHID VARBINARY(64);
|
||||||
@@ -7590,6 +7590,7 @@ phutil_register_library_map(array(
|
|||||||
'PhabricatorTokenReceiverInterface',
|
'PhabricatorTokenReceiverInterface',
|
||||||
'PhabricatorProjectInterface',
|
'PhabricatorProjectInterface',
|
||||||
'PhabricatorDestructibleInterface',
|
'PhabricatorDestructibleInterface',
|
||||||
|
'PhabricatorSpacesInterface',
|
||||||
),
|
),
|
||||||
'PonderQuestionCommentController' => 'PonderController',
|
'PonderQuestionCommentController' => 'PonderController',
|
||||||
'PonderQuestionDefaultEditCapability' => 'PhabricatorPolicyCapability',
|
'PonderQuestionDefaultEditCapability' => 'PhabricatorPolicyCapability',
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ final class PonderQuestionEditController extends PonderController {
|
|||||||
$v_content = $question->getContent();
|
$v_content = $question->getContent();
|
||||||
$v_view = $question->getViewPolicy();
|
$v_view = $question->getViewPolicy();
|
||||||
$v_edit = $question->getEditPolicy();
|
$v_edit = $question->getEditPolicy();
|
||||||
|
$v_space = $question->getSpacePHID();
|
||||||
|
|
||||||
$errors = array();
|
$errors = array();
|
||||||
$e_title = true;
|
$e_title = true;
|
||||||
@@ -41,6 +42,7 @@ final class PonderQuestionEditController extends PonderController {
|
|||||||
$v_projects = $request->getArr('projects');
|
$v_projects = $request->getArr('projects');
|
||||||
$v_view = $request->getStr('viewPolicy');
|
$v_view = $request->getStr('viewPolicy');
|
||||||
$v_edit = $request->getStr('editPolicy');
|
$v_edit = $request->getStr('editPolicy');
|
||||||
|
$v_space = $request->getStr('spacePHID');
|
||||||
|
|
||||||
$len = phutil_utf8_strlen($v_title);
|
$len = phutil_utf8_strlen($v_title);
|
||||||
if ($len < 1) {
|
if ($len < 1) {
|
||||||
@@ -71,6 +73,10 @@ final class PonderQuestionEditController extends PonderController {
|
|||||||
->setTransactionType(PhabricatorTransactions::TYPE_EDIT_POLICY)
|
->setTransactionType(PhabricatorTransactions::TYPE_EDIT_POLICY)
|
||||||
->setNewValue($v_edit);
|
->setNewValue($v_edit);
|
||||||
|
|
||||||
|
$xactions[] = id(clone $template)
|
||||||
|
->setTransactionType(PhabricatorTransactions::TYPE_SPACE)
|
||||||
|
->setNewValue($v_space);
|
||||||
|
|
||||||
$proj_edge_type = PhabricatorProjectObjectHasProjectEdgeType::EDGECONST;
|
$proj_edge_type = PhabricatorProjectObjectHasProjectEdgeType::EDGECONST;
|
||||||
$xactions[] = id(new PonderQuestionTransaction())
|
$xactions[] = id(new PonderQuestionTransaction())
|
||||||
->setTransactionType(PhabricatorTransactions::TYPE_EDGE)
|
->setTransactionType(PhabricatorTransactions::TYPE_EDGE)
|
||||||
@@ -114,6 +120,7 @@ final class PonderQuestionEditController extends PonderController {
|
|||||||
id(new AphrontFormPolicyControl())
|
id(new AphrontFormPolicyControl())
|
||||||
->setName('viewPolicy')
|
->setName('viewPolicy')
|
||||||
->setPolicyObject($question)
|
->setPolicyObject($question)
|
||||||
|
->setSpacePHID($v_space)
|
||||||
->setPolicies($policies)
|
->setPolicies($policies)
|
||||||
->setValue($v_view)
|
->setValue($v_view)
|
||||||
->setCapability(PhabricatorPolicyCapability::CAN_VIEW))
|
->setCapability(PhabricatorPolicyCapability::CAN_VIEW))
|
||||||
|
|||||||
@@ -38,7 +38,9 @@ final class PonderQuestionViewController extends PonderController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$header = id(new PHUIHeaderView())
|
$header = id(new PHUIHeaderView())
|
||||||
->setHeader($question->getTitle());
|
->setHeader($question->getTitle())
|
||||||
|
->setUser($user)
|
||||||
|
->setPolicyObject($question);
|
||||||
|
|
||||||
if ($question->getStatus() == PonderQuestionStatus::STATUS_OPEN) {
|
if ($question->getStatus() == PonderQuestionStatus::STATUS_OPEN) {
|
||||||
$header->setStatus('fa-square-o', 'bluegrey', pht('Open'));
|
$header->setStatus('fa-square-o', 'bluegrey', pht('Open'));
|
||||||
|
|||||||
@@ -68,6 +68,7 @@ final class PonderQuestionEditor
|
|||||||
$types[] = PhabricatorTransactions::TYPE_COMMENT;
|
$types[] = PhabricatorTransactions::TYPE_COMMENT;
|
||||||
$types[] = PhabricatorTransactions::TYPE_VIEW_POLICY;
|
$types[] = PhabricatorTransactions::TYPE_VIEW_POLICY;
|
||||||
$types[] = PhabricatorTransactions::TYPE_EDIT_POLICY;
|
$types[] = PhabricatorTransactions::TYPE_EDIT_POLICY;
|
||||||
|
$types[] = PhabricatorTransactions::TYPE_SPACE;
|
||||||
|
|
||||||
$types[] = PonderQuestionTransaction::TYPE_TITLE;
|
$types[] = PonderQuestionTransaction::TYPE_TITLE;
|
||||||
$types[] = PonderQuestionTransaction::TYPE_CONTENT;
|
$types[] = PonderQuestionTransaction::TYPE_CONTENT;
|
||||||
|
|||||||
@@ -10,7 +10,8 @@ final class PonderQuestion extends PonderDAO
|
|||||||
PhabricatorPolicyInterface,
|
PhabricatorPolicyInterface,
|
||||||
PhabricatorTokenReceiverInterface,
|
PhabricatorTokenReceiverInterface,
|
||||||
PhabricatorProjectInterface,
|
PhabricatorProjectInterface,
|
||||||
PhabricatorDestructibleInterface {
|
PhabricatorDestructibleInterface,
|
||||||
|
PhabricatorSpacesInterface {
|
||||||
|
|
||||||
const MARKUP_FIELD_CONTENT = 'markup:content';
|
const MARKUP_FIELD_CONTENT = 'markup:content';
|
||||||
|
|
||||||
@@ -23,6 +24,7 @@ final class PonderQuestion extends PonderDAO
|
|||||||
protected $contentSource;
|
protected $contentSource;
|
||||||
protected $viewPolicy;
|
protected $viewPolicy;
|
||||||
protected $editPolicy;
|
protected $editPolicy;
|
||||||
|
protected $spacePHID;
|
||||||
|
|
||||||
protected $voteCount;
|
protected $voteCount;
|
||||||
protected $answerCount;
|
protected $answerCount;
|
||||||
@@ -53,7 +55,8 @@ final class PonderQuestion extends PonderDAO
|
|||||||
->setStatus(PonderQuestionStatus::STATUS_OPEN)
|
->setStatus(PonderQuestionStatus::STATUS_OPEN)
|
||||||
->setVoteCount(0)
|
->setVoteCount(0)
|
||||||
->setAnswerCount(0)
|
->setAnswerCount(0)
|
||||||
->setHeat(0.0);
|
->setHeat(0.0)
|
||||||
|
->setSpacePHID($actor->getDefaultSpacePHID());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getConfiguration() {
|
protected function getConfiguration() {
|
||||||
@@ -329,4 +332,12 @@ final class PonderQuestion extends PonderDAO
|
|||||||
$this->saveTransaction();
|
$this->saveTransaction();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* -( PhabricatorSpacesInterface )----------------------------------------- */
|
||||||
|
|
||||||
|
|
||||||
|
public function getSpacePHID() {
|
||||||
|
return $this->spacePHID;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user