mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-18 11:30:55 +01:00
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:
parent
fdc1662bfd
commit
a3b955f948
6 changed files with 27 additions and 3 deletions
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',
|
||||
'PhabricatorProjectInterface',
|
||||
'PhabricatorDestructibleInterface',
|
||||
'PhabricatorSpacesInterface',
|
||||
),
|
||||
'PonderQuestionCommentController' => 'PonderController',
|
||||
'PonderQuestionDefaultEditCapability' => 'PhabricatorPolicyCapability',
|
||||
|
|
|
@ -32,6 +32,7 @@ final class PonderQuestionEditController extends PonderController {
|
|||
$v_content = $question->getContent();
|
||||
$v_view = $question->getViewPolicy();
|
||||
$v_edit = $question->getEditPolicy();
|
||||
$v_space = $question->getSpacePHID();
|
||||
|
||||
$errors = array();
|
||||
$e_title = true;
|
||||
|
@ -41,6 +42,7 @@ final class PonderQuestionEditController extends PonderController {
|
|||
$v_projects = $request->getArr('projects');
|
||||
$v_view = $request->getStr('viewPolicy');
|
||||
$v_edit = $request->getStr('editPolicy');
|
||||
$v_space = $request->getStr('spacePHID');
|
||||
|
||||
$len = phutil_utf8_strlen($v_title);
|
||||
if ($len < 1) {
|
||||
|
@ -71,6 +73,10 @@ final class PonderQuestionEditController extends PonderController {
|
|||
->setTransactionType(PhabricatorTransactions::TYPE_EDIT_POLICY)
|
||||
->setNewValue($v_edit);
|
||||
|
||||
$xactions[] = id(clone $template)
|
||||
->setTransactionType(PhabricatorTransactions::TYPE_SPACE)
|
||||
->setNewValue($v_space);
|
||||
|
||||
$proj_edge_type = PhabricatorProjectObjectHasProjectEdgeType::EDGECONST;
|
||||
$xactions[] = id(new PonderQuestionTransaction())
|
||||
->setTransactionType(PhabricatorTransactions::TYPE_EDGE)
|
||||
|
@ -114,6 +120,7 @@ final class PonderQuestionEditController extends PonderController {
|
|||
id(new AphrontFormPolicyControl())
|
||||
->setName('viewPolicy')
|
||||
->setPolicyObject($question)
|
||||
->setSpacePHID($v_space)
|
||||
->setPolicies($policies)
|
||||
->setValue($v_view)
|
||||
->setCapability(PhabricatorPolicyCapability::CAN_VIEW))
|
||||
|
|
|
@ -38,7 +38,9 @@ final class PonderQuestionViewController extends PonderController {
|
|||
}
|
||||
|
||||
$header = id(new PHUIHeaderView())
|
||||
->setHeader($question->getTitle());
|
||||
->setHeader($question->getTitle())
|
||||
->setUser($user)
|
||||
->setPolicyObject($question);
|
||||
|
||||
if ($question->getStatus() == PonderQuestionStatus::STATUS_OPEN) {
|
||||
$header->setStatus('fa-square-o', 'bluegrey', pht('Open'));
|
||||
|
|
|
@ -68,6 +68,7 @@ final class PonderQuestionEditor
|
|||
$types[] = PhabricatorTransactions::TYPE_COMMENT;
|
||||
$types[] = PhabricatorTransactions::TYPE_VIEW_POLICY;
|
||||
$types[] = PhabricatorTransactions::TYPE_EDIT_POLICY;
|
||||
$types[] = PhabricatorTransactions::TYPE_SPACE;
|
||||
|
||||
$types[] = PonderQuestionTransaction::TYPE_TITLE;
|
||||
$types[] = PonderQuestionTransaction::TYPE_CONTENT;
|
||||
|
|
|
@ -10,7 +10,8 @@ final class PonderQuestion extends PonderDAO
|
|||
PhabricatorPolicyInterface,
|
||||
PhabricatorTokenReceiverInterface,
|
||||
PhabricatorProjectInterface,
|
||||
PhabricatorDestructibleInterface {
|
||||
PhabricatorDestructibleInterface,
|
||||
PhabricatorSpacesInterface {
|
||||
|
||||
const MARKUP_FIELD_CONTENT = 'markup:content';
|
||||
|
||||
|
@ -23,6 +24,7 @@ final class PonderQuestion extends PonderDAO
|
|||
protected $contentSource;
|
||||
protected $viewPolicy;
|
||||
protected $editPolicy;
|
||||
protected $spacePHID;
|
||||
|
||||
protected $voteCount;
|
||||
protected $answerCount;
|
||||
|
@ -53,7 +55,8 @@ final class PonderQuestion extends PonderDAO
|
|||
->setStatus(PonderQuestionStatus::STATUS_OPEN)
|
||||
->setVoteCount(0)
|
||||
->setAnswerCount(0)
|
||||
->setHeat(0.0);
|
||||
->setHeat(0.0)
|
||||
->setSpacePHID($actor->getDefaultSpacePHID());
|
||||
}
|
||||
|
||||
protected function getConfiguration() {
|
||||
|
@ -329,4 +332,12 @@ final class PonderQuestion extends PonderDAO
|
|||
$this->saveTransaction();
|
||||
}
|
||||
|
||||
|
||||
/* -( PhabricatorSpacesInterface )----------------------------------------- */
|
||||
|
||||
|
||||
public function getSpacePHID() {
|
||||
return $this->spacePHID;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue