Page MenuHomePhabricator

D13792.diff
No OneTemporary

D13792.diff

diff --git a/resources/sql/autopatches/20150804.ponder.spaces.4.sql b/resources/sql/autopatches/20150804.ponder.spaces.4.sql
new file mode 100644
--- /dev/null
+++ b/resources/sql/autopatches/20150804.ponder.spaces.4.sql
@@ -0,0 +1,2 @@
+ALTER TABLE {$NAMESPACE}_ponder.ponder_question
+ 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
@@ -7590,6 +7590,7 @@
'PhabricatorTokenReceiverInterface',
'PhabricatorProjectInterface',
'PhabricatorDestructibleInterface',
+ 'PhabricatorSpacesInterface',
),
'PonderQuestionCommentController' => 'PonderController',
'PonderQuestionDefaultEditCapability' => 'PhabricatorPolicyCapability',
diff --git a/src/applications/ponder/controller/PonderQuestionEditController.php b/src/applications/ponder/controller/PonderQuestionEditController.php
--- a/src/applications/ponder/controller/PonderQuestionEditController.php
+++ b/src/applications/ponder/controller/PonderQuestionEditController.php
@@ -32,6 +32,7 @@
$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 @@
$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 @@
->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 @@
id(new AphrontFormPolicyControl())
->setName('viewPolicy')
->setPolicyObject($question)
+ ->setSpacePHID($v_space)
->setPolicies($policies)
->setValue($v_view)
->setCapability(PhabricatorPolicyCapability::CAN_VIEW))
diff --git a/src/applications/ponder/controller/PonderQuestionViewController.php b/src/applications/ponder/controller/PonderQuestionViewController.php
--- a/src/applications/ponder/controller/PonderQuestionViewController.php
+++ b/src/applications/ponder/controller/PonderQuestionViewController.php
@@ -38,7 +38,9 @@
}
$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'));
diff --git a/src/applications/ponder/editor/PonderQuestionEditor.php b/src/applications/ponder/editor/PonderQuestionEditor.php
--- a/src/applications/ponder/editor/PonderQuestionEditor.php
+++ b/src/applications/ponder/editor/PonderQuestionEditor.php
@@ -68,6 +68,7 @@
$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;
diff --git a/src/applications/ponder/storage/PonderQuestion.php b/src/applications/ponder/storage/PonderQuestion.php
--- a/src/applications/ponder/storage/PonderQuestion.php
+++ b/src/applications/ponder/storage/PonderQuestion.php
@@ -10,7 +10,8 @@
PhabricatorPolicyInterface,
PhabricatorTokenReceiverInterface,
PhabricatorProjectInterface,
- PhabricatorDestructibleInterface {
+ PhabricatorDestructibleInterface,
+ PhabricatorSpacesInterface {
const MARKUP_FIELD_CONTENT = 'markup:content';
@@ -23,6 +24,7 @@
protected $contentSource;
protected $viewPolicy;
protected $editPolicy;
+ protected $spacePHID;
protected $voteCount;
protected $answerCount;
@@ -53,7 +55,8 @@
->setStatus(PonderQuestionStatus::STATUS_OPEN)
->setVoteCount(0)
->setAnswerCount(0)
- ->setHeat(0.0);
+ ->setHeat(0.0)
+ ->setSpacePHID($actor->getDefaultSpacePHID());
}
protected function getConfiguration() {
@@ -329,4 +332,12 @@
$this->saveTransaction();
}
+
+/* -( PhabricatorSpacesInterface )----------------------------------------- */
+
+
+ public function getSpacePHID() {
+ return $this->spacePHID;
+ }
+
}

File Metadata

Mime Type
text/plain
Expires
Wed, Mar 5, 1:45 PM (14 h, 11 m ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7225685
Default Alt Text
D13792.diff (4 KB)

Event Timeline