@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.

Add a "slowvote.poll.search" API method

Summary: Ref T13350. Add a modern "*.search" API method for Slowvote so "slowvote.info" can be deprecated with a reasonable replacement.

Test Plan: Used Conduit test console to call method, saw reasonable results.

Maniphest Tasks: T13350

Differential Revision: https://secure.phabricator.com/D20685

+60 -6
+3
src/__phutil_library_map__.php
··· 5614 5614 'SlowvoteEmbedView' => 'applications/slowvote/view/SlowvoteEmbedView.php', 5615 5615 'SlowvoteInfoConduitAPIMethod' => 'applications/slowvote/conduit/SlowvoteInfoConduitAPIMethod.php', 5616 5616 'SlowvoteRemarkupRule' => 'applications/slowvote/remarkup/SlowvoteRemarkupRule.php', 5617 + 'SlowvoteSearchConduitAPIMethod' => 'applications/slowvote/conduit/SlowvoteSearchConduitAPIMethod.php', 5617 5618 'SubscriptionListDialogBuilder' => 'applications/subscriptions/view/SubscriptionListDialogBuilder.php', 5618 5619 'SubscriptionListStringBuilder' => 'applications/subscriptions/view/SubscriptionListStringBuilder.php', 5619 5620 'TokenConduitAPIMethod' => 'applications/tokens/conduit/TokenConduitAPIMethod.php', ··· 11075 11076 'PhabricatorProjectInterface', 11076 11077 'PhabricatorDestructibleInterface', 11077 11078 'PhabricatorSpacesInterface', 11079 + 'PhabricatorConduitResultInterface', 11078 11080 ), 11079 11081 'PhabricatorSlowvotePollController' => 'PhabricatorSlowvoteController', 11080 11082 'PhabricatorSlowvotePollPHIDType' => 'PhabricatorPHIDType', ··· 12221 12223 'SlowvoteEmbedView' => 'AphrontView', 12222 12224 'SlowvoteInfoConduitAPIMethod' => 'SlowvoteConduitAPIMethod', 12223 12225 'SlowvoteRemarkupRule' => 'PhabricatorObjectRemarkupRule', 12226 + 'SlowvoteSearchConduitAPIMethod' => 'PhabricatorSearchEngineAPIMethod', 12224 12227 'SubscriptionListDialogBuilder' => 'Phobject', 12225 12228 'SubscriptionListStringBuilder' => 'Phobject', 12226 12229 'TokenConduitAPIMethod' => 'ConduitAPIMethod',
+18
src/applications/slowvote/conduit/SlowvoteSearchConduitAPIMethod.php
··· 1 + <?php 2 + 3 + final class SlowvoteSearchConduitAPIMethod 4 + extends PhabricatorSearchEngineAPIMethod { 5 + 6 + public function getAPIMethodName() { 7 + return 'slowvote.poll.search'; 8 + } 9 + 10 + public function newSearchEngine() { 11 + return new PhabricatorSlowvoteSearchEngine(); 12 + } 13 + 14 + public function getMethodSummary() { 15 + return pht('Read information about polls.'); 16 + } 17 + 18 + }
+10 -4
src/applications/slowvote/query/PhabricatorSlowvoteSearchEngine.php
··· 46 46 ->setKey('authorPHIDs') 47 47 ->setAliases(array('authors')) 48 48 ->setLabel(pht('Authors')), 49 - 50 49 id(new PhabricatorSearchCheckboxesField()) 51 50 ->setKey('voted') 51 + ->setLabel(pht('Voted')) 52 + 53 + // TODO: This should probably become a list of "voterPHIDs", so hide 54 + // the field from Conduit to avoid a backward compatibility break when 55 + // this changes. 56 + 57 + ->setEnableForConduit(false) 52 58 ->setOptions(array( 53 59 'voted' => pht("Show only polls I've voted in."), 54 60 )), 55 - 56 61 id(new PhabricatorSearchCheckboxesField()) 57 62 ->setKey('statuses') 58 63 ->setLabel(pht('Statuses')) 59 - ->setOptions(array( 64 + ->setOptions( 65 + array( 60 66 'open' => pht('Open'), 61 67 'closed' => pht('Closed'), 62 - )), 68 + )), 63 69 ); 64 70 } 65 71
+29 -2
src/applications/slowvote/storage/PhabricatorSlowvotePoll.php
··· 9 9 PhabricatorTokenReceiverInterface, 10 10 PhabricatorProjectInterface, 11 11 PhabricatorDestructibleInterface, 12 - PhabricatorSpacesInterface { 12 + PhabricatorSpacesInterface, 13 + PhabricatorConduitResultInterface { 13 14 14 15 const RESPONSES_VISIBLE = 0; 15 16 const RESPONSES_VOTERS = 1; ··· 202 203 $this->saveTransaction(); 203 204 } 204 205 205 - /* -( PhabricatorSpacesInterface )--------------------------------------- */ 206 + /* -( PhabricatorSpacesInterface )----------------------------------------- */ 206 207 207 208 public function getSpacePHID() { 208 209 return $this->spacePHID; 210 + } 211 + 212 + /* -( PhabricatorConduitResultInterface )---------------------------------- */ 213 + 214 + public function getFieldSpecificationsForConduit() { 215 + return array( 216 + id(new PhabricatorConduitSearchFieldSpecification()) 217 + ->setKey('name') 218 + ->setType('string') 219 + ->setDescription(pht('The name of the poll.')), 220 + id(new PhabricatorConduitSearchFieldSpecification()) 221 + ->setKey('authorPHID') 222 + ->setType('string') 223 + ->setDescription(pht('The author of the poll.')), 224 + ); 225 + } 226 + 227 + public function getFieldValuesForConduit() { 228 + return array( 229 + 'name' => $this->getQuestion(), 230 + 'authorPHID' => $this->getAuthorPHID(), 231 + ); 232 + } 233 + 234 + public function getConduitSearchAttachments() { 235 + return array(); 209 236 } 210 237 211 238 }