@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

authored by

lkassianik and committed by
epriestley
15a1f083 79366795

+33 -2
+29 -1
src/applications/slowvote/controller/PhabricatorSlowvoteEditController.php
··· 36 36 $is_new = true; 37 37 } 38 38 39 + if ($is_new) { 40 + $v_projects = array(); 41 + } else { 42 + $v_projects = PhabricatorEdgeQuery::loadDestinationPHIDs( 43 + $poll->getPHID(), 44 + PhabricatorEdgeConfig::TYPE_OBJECT_HAS_PROJECT); 45 + $v_projects = array_reverse($v_projects); 46 + } 47 + 39 48 $e_question = true; 40 49 $e_response = true; 41 50 $errors = array(); ··· 52 61 $v_responses = (int)$request->getInt('responses'); 53 62 $v_shuffle = (int)$request->getBool('shuffle'); 54 63 $v_view_policy = $request->getStr('viewPolicy'); 64 + $v_projects = $request->getArr('projects'); 55 65 56 66 if ($is_new) { 57 67 $poll->setMethod($request->getInt('method')); ··· 98 108 ->setNewValue($v_view_policy); 99 109 100 110 if (empty($errors)) { 111 + $proj_edge_type = PhabricatorEdgeConfig::TYPE_OBJECT_HAS_PROJECT; 112 + $xactions[] = id(new PhabricatorSlowvoteTransaction()) 113 + ->setTransactionType(PhabricatorTransactions::TYPE_EDGE) 114 + ->setMetadataValue('edge:type', $proj_edge_type) 115 + ->setNewValue(array('=' => array_fuse($v_projects))); 116 + 101 117 $editor = id(new PhabricatorSlowvoteEditor()) 102 118 ->setActor($user) 103 119 ->setContinueOnNoEffect(true) ··· 132 148 pht('Resolve issues and build consensus through '. 133 149 'protracted deliberation.')); 134 150 151 + if ($v_projects) { 152 + $project_handles = $this->loadViewerHandles($v_projects); 153 + } else { 154 + $project_handles = array(); 155 + } 156 + 135 157 $form = id(new AphrontFormView()) 136 158 ->setUser($user) 137 159 ->appendChild($instructions) ··· 146 168 id(new PhabricatorRemarkupControl()) 147 169 ->setLabel(pht('Description')) 148 170 ->setName('description') 149 - ->setValue($v_description)); 171 + ->setValue($v_description)) 172 + ->appendChild( 173 + id(new AphrontFormTokenizerControl()) 174 + ->setLabel(pht('Projects')) 175 + ->setName('projects') 176 + ->setValue($project_handles) 177 + ->setDatasource('/typeahead/common/projects/')); 150 178 151 179 if ($is_new) { 152 180 for ($ii = 0; $ii < 10; $ii++) {
+2
src/applications/slowvote/editor/PhabricatorSlowvoteEditor.php
··· 94 94 case PhabricatorSlowvoteTransaction::TYPE_CLOSE: 95 95 $object->setIsClosed((int)$xaction->getNewValue()); 96 96 break; 97 + case PhabricatorTransactions::TYPE_EDGE: 98 + return; 97 99 } 98 100 } 99 101
+2 -1
src/applications/slowvote/storage/PhabricatorSlowvotePoll.php
··· 8 8 PhabricatorPolicyInterface, 9 9 PhabricatorSubscribableInterface, 10 10 PhabricatorFlaggableInterface, 11 - PhabricatorTokenReceiverInterface { 11 + PhabricatorTokenReceiverInterface, 12 + PhabricatorProjectInterface { 12 13 13 14 const RESPONSES_VISIBLE = 0; 14 15 const RESPONSES_VOTERS = 1;