Adding project tags to slowvote polls
Summary: T2628, project tags in slowvote polls Test Plan: Open poll, edit, add project tags, save. Poll should show tagged projects and a relevant transaction. (transaction doesn't currently show up) Reviewers: epriestley, #blessed_reviewers Reviewed By: epriestley, #blessed_reviewers Subscribers: epriestley, Korvin Differential Revision: https://secure.phabricator.com/D9708
This commit is contained in:
		| @@ -36,6 +36,15 @@ final class PhabricatorSlowvoteEditController | |||||||
|       $is_new = true; |       $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_question = true; | ||||||
|     $e_response = true; |     $e_response = true; | ||||||
|     $errors = array(); |     $errors = array(); | ||||||
| @@ -52,6 +61,7 @@ final class PhabricatorSlowvoteEditController | |||||||
|       $v_responses = (int)$request->getInt('responses'); |       $v_responses = (int)$request->getInt('responses'); | ||||||
|       $v_shuffle = (int)$request->getBool('shuffle'); |       $v_shuffle = (int)$request->getBool('shuffle'); | ||||||
|       $v_view_policy = $request->getStr('viewPolicy'); |       $v_view_policy = $request->getStr('viewPolicy'); | ||||||
|  |       $v_projects = $request->getArr('projects'); | ||||||
|  |  | ||||||
|       if ($is_new) { |       if ($is_new) { | ||||||
|         $poll->setMethod($request->getInt('method')); |         $poll->setMethod($request->getInt('method')); | ||||||
| @@ -98,6 +108,12 @@ final class PhabricatorSlowvoteEditController | |||||||
|         ->setNewValue($v_view_policy); |         ->setNewValue($v_view_policy); | ||||||
|  |  | ||||||
|       if (empty($errors)) { |       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()) |         $editor = id(new PhabricatorSlowvoteEditor()) | ||||||
|           ->setActor($user) |           ->setActor($user) | ||||||
|           ->setContinueOnNoEffect(true) |           ->setContinueOnNoEffect(true) | ||||||
| @@ -132,6 +148,12 @@ final class PhabricatorSlowvoteEditController | |||||||
|         pht('Resolve issues and build consensus through '. |         pht('Resolve issues and build consensus through '. | ||||||
|           'protracted deliberation.')); |           'protracted deliberation.')); | ||||||
|  |  | ||||||
|  |     if ($v_projects) { | ||||||
|  |       $project_handles = $this->loadViewerHandles($v_projects); | ||||||
|  |     } else { | ||||||
|  |       $project_handles = array(); | ||||||
|  |     } | ||||||
|  |  | ||||||
|     $form = id(new AphrontFormView()) |     $form = id(new AphrontFormView()) | ||||||
|       ->setUser($user) |       ->setUser($user) | ||||||
|       ->appendChild($instructions) |       ->appendChild($instructions) | ||||||
| @@ -146,7 +168,13 @@ final class PhabricatorSlowvoteEditController | |||||||
|         id(new PhabricatorRemarkupControl()) |         id(new PhabricatorRemarkupControl()) | ||||||
|           ->setLabel(pht('Description')) |           ->setLabel(pht('Description')) | ||||||
|           ->setName('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) { |     if ($is_new) { | ||||||
|       for ($ii = 0; $ii < 10; $ii++) { |       for ($ii = 0; $ii < 10; $ii++) { | ||||||
|   | |||||||
| @@ -94,6 +94,8 @@ final class PhabricatorSlowvoteEditor | |||||||
|       case PhabricatorSlowvoteTransaction::TYPE_CLOSE: |       case PhabricatorSlowvoteTransaction::TYPE_CLOSE: | ||||||
|         $object->setIsClosed((int)$xaction->getNewValue()); |         $object->setIsClosed((int)$xaction->getNewValue()); | ||||||
|         break; |         break; | ||||||
|  |       case PhabricatorTransactions::TYPE_EDGE: | ||||||
|  |         return; | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -8,7 +8,8 @@ final class PhabricatorSlowvotePoll extends PhabricatorSlowvoteDAO | |||||||
|     PhabricatorPolicyInterface, |     PhabricatorPolicyInterface, | ||||||
|     PhabricatorSubscribableInterface, |     PhabricatorSubscribableInterface, | ||||||
|     PhabricatorFlaggableInterface, |     PhabricatorFlaggableInterface, | ||||||
|     PhabricatorTokenReceiverInterface { |     PhabricatorTokenReceiverInterface, | ||||||
|  |     PhabricatorProjectInterface { | ||||||
|  |  | ||||||
|   const RESPONSES_VISIBLE = 0; |   const RESPONSES_VISIBLE = 0; | ||||||
|   const RESPONSES_VOTERS  = 1; |   const RESPONSES_VOTERS  = 1; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 lkassianik
					lkassianik