Page MenuHomePhabricator

D9708.diff
No OneTemporary

D9708.diff

diff --git a/src/applications/slowvote/controller/PhabricatorSlowvoteEditController.php b/src/applications/slowvote/controller/PhabricatorSlowvoteEditController.php
--- a/src/applications/slowvote/controller/PhabricatorSlowvoteEditController.php
+++ b/src/applications/slowvote/controller/PhabricatorSlowvoteEditController.php
@@ -36,6 +36,15 @@
$is_new = true;
}
+ if ($is_new) {
+ $v_projects = array();
+ } else {
+ $v_projects = PhabricatorEdgeQuery::loadDestinationPHIDs(
+ $poll->getPHID(),
+ PhabricatorEdgeConfig::TYPE_OBJECT_HAS_PROJECT);
+ $v_projects = array_reverse($v_projects);
+ }
+
$e_question = true;
$e_response = true;
$errors = array();
@@ -52,6 +61,7 @@
$v_responses = (int)$request->getInt('responses');
$v_shuffle = (int)$request->getBool('shuffle');
$v_view_policy = $request->getStr('viewPolicy');
+ $v_projects = $request->getArr('projects');
if ($is_new) {
$poll->setMethod($request->getInt('method'));
@@ -98,6 +108,12 @@
->setNewValue($v_view_policy);
if (empty($errors)) {
+ $proj_edge_type = PhabricatorEdgeConfig::TYPE_OBJECT_HAS_PROJECT;
+ $xactions[] = id(new PhabricatorSlowvoteTransaction())
+ ->setTransactionType(PhabricatorTransactions::TYPE_EDGE)
+ ->setMetadataValue('edge:type', $proj_edge_type)
+ ->setNewValue(array('=' => array_fuse($v_projects)));
+
$editor = id(new PhabricatorSlowvoteEditor())
->setActor($user)
->setContinueOnNoEffect(true)
@@ -132,6 +148,12 @@
pht('Resolve issues and build consensus through '.
'protracted deliberation.'));
+ if ($v_projects) {
+ $project_handles = $this->loadViewerHandles($v_projects);
+ } else {
+ $project_handles = array();
+ }
+
$form = id(new AphrontFormView())
->setUser($user)
->appendChild($instructions)
@@ -146,7 +168,13 @@
id(new PhabricatorRemarkupControl())
->setLabel(pht('Description'))
->setName('description')
- ->setValue($v_description));
+ ->setValue($v_description))
+ ->appendChild(
+ id(new AphrontFormTokenizerControl())
+ ->setLabel(pht('Projects'))
+ ->setName('projects')
+ ->setValue($project_handles)
+ ->setDatasource('/typeahead/common/projects/'));
if ($is_new) {
for ($ii = 0; $ii < 10; $ii++) {
diff --git a/src/applications/slowvote/editor/PhabricatorSlowvoteEditor.php b/src/applications/slowvote/editor/PhabricatorSlowvoteEditor.php
--- a/src/applications/slowvote/editor/PhabricatorSlowvoteEditor.php
+++ b/src/applications/slowvote/editor/PhabricatorSlowvoteEditor.php
@@ -94,6 +94,8 @@
case PhabricatorSlowvoteTransaction::TYPE_CLOSE:
$object->setIsClosed((int)$xaction->getNewValue());
break;
+ case PhabricatorTransactions::TYPE_EDGE:
+ return;
}
}
diff --git a/src/applications/slowvote/storage/PhabricatorSlowvotePoll.php b/src/applications/slowvote/storage/PhabricatorSlowvotePoll.php
--- a/src/applications/slowvote/storage/PhabricatorSlowvotePoll.php
+++ b/src/applications/slowvote/storage/PhabricatorSlowvotePoll.php
@@ -8,7 +8,8 @@
PhabricatorPolicyInterface,
PhabricatorSubscribableInterface,
PhabricatorFlaggableInterface,
- PhabricatorTokenReceiverInterface {
+ PhabricatorTokenReceiverInterface,
+ PhabricatorProjectInterface {
const RESPONSES_VISIBLE = 0;
const RESPONSES_VOTERS = 1;

File Metadata

Mime Type
text/plain
Expires
Fri, Dec 20, 4:03 AM (20 h, 57 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6909468
Default Alt Text
D9708.diff (3 KB)

Event Timeline