Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15446537
D9447.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D9447.diff
View Options
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
@@ -25,6 +25,10 @@
if (!$question) {
return new Aphront404Response();
}
+ $v_projects = PhabricatorEdgeQuery::loadDestinationPHIDs(
+ $question->getPHID(),
+ PhabricatorEdgeConfig::TYPE_OBJECT_HAS_PROJECT);
+ $v_projects = array_reverse($v_projects);
} else {
$question = id(new PonderQuestion())
->setStatus(PonderQuestionStatus::STATUS_OPEN)
@@ -32,6 +36,7 @@
->setVoteCount(0)
->setAnswerCount(0)
->setHeat(0.0);
+ $v_projects = array();
}
$v_title = $question->getTitle();
@@ -42,6 +47,7 @@
if ($request->isFormPost()) {
$v_title = $request->getStr('title');
$v_content = $request->getStr('content');
+ $v_projects = $request->getArr('projects');
$len = phutil_utf8_strlen($v_title);
if ($len < 1) {
@@ -64,6 +70,12 @@
->setTransactionType(PonderQuestionTransaction::TYPE_CONTENT)
->setNewValue($v_content);
+ $proj_edge_type = PhabricatorEdgeConfig::TYPE_OBJECT_HAS_PROJECT;
+ $xactions[] = id(new PonderQuestionTransaction())
+ ->setTransactionType(PhabricatorTransactions::TYPE_EDGE)
+ ->setMetadataValue('edge:type', $proj_edge_type)
+ ->setNewValue(array('=' => array_fuse($v_projects)));
+
$editor = id(new PonderQuestionEditor())
->setActor($user)
->setContentSourceFromRequest($request)
@@ -90,11 +102,25 @@
->setID('content')
->setValue($v_content)
->setLabel(pht('Description'))
- ->setUser($user))
- ->appendChild(
- id(new AphrontFormSubmitControl())
- ->addCancelButton($this->getApplicationURI())
- ->setValue(pht('Ask Away!')));
+ ->setUser($user));
+
+ if ($v_projects) {
+ $project_handles = $this->loadViewerHandles($v_projects);
+ } else {
+ $project_handles = array();
+ }
+
+ $form->appendChild(
+ id(new AphrontFormTokenizerControl())
+ ->setLabel(pht('Projects'))
+ ->setName('projects')
+ ->setValue($project_handles)
+ ->setDatasource('/typeahead/common/projects/'));
+
+ $form ->appendChild(
+ id(new AphrontFormSubmitControl())
+ ->addCancelButton($this->getApplicationURI())
+ ->setValue(pht('Ask Away!')));
$preview = id(new PHUIRemarkupPreviewPanel())
->setHeader(pht('Question Preview'))
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
@@ -141,6 +141,8 @@
$object->setAnswerCount($count);
break;
+ case PhabricatorTransactions::TYPE_EDGE:
+ return;
}
}
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
@@ -7,7 +7,8 @@
PhabricatorSubscribableInterface,
PhabricatorFlaggableInterface,
PhabricatorPolicyInterface,
- PhabricatorTokenReceiverInterface {
+ PhabricatorTokenReceiverInterface,
+ PhabricatorProjectInterface {
const MARKUP_FIELD_CONTENT = 'markup:content';
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Mar 28, 7:31 PM (4 w, 1 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7385245
Default Alt Text
D9447.diff (3 KB)
Attached To
Mode
D9447: Add project tags to PonderQuestion
Attached
Detach File
Event Timeline
Log In to Comment