diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -5614,6 +5614,7 @@ 'SlowvoteEmbedView' => 'applications/slowvote/view/SlowvoteEmbedView.php', 'SlowvoteInfoConduitAPIMethod' => 'applications/slowvote/conduit/SlowvoteInfoConduitAPIMethod.php', 'SlowvoteRemarkupRule' => 'applications/slowvote/remarkup/SlowvoteRemarkupRule.php', + 'SlowvoteSearchConduitAPIMethod' => 'applications/slowvote/conduit/SlowvoteSearchConduitAPIMethod.php', 'SubscriptionListDialogBuilder' => 'applications/subscriptions/view/SubscriptionListDialogBuilder.php', 'SubscriptionListStringBuilder' => 'applications/subscriptions/view/SubscriptionListStringBuilder.php', 'TokenConduitAPIMethod' => 'applications/tokens/conduit/TokenConduitAPIMethod.php', @@ -11075,6 +11076,7 @@ 'PhabricatorProjectInterface', 'PhabricatorDestructibleInterface', 'PhabricatorSpacesInterface', + 'PhabricatorConduitResultInterface', ), 'PhabricatorSlowvotePollController' => 'PhabricatorSlowvoteController', 'PhabricatorSlowvotePollPHIDType' => 'PhabricatorPHIDType', @@ -12221,6 +12223,7 @@ 'SlowvoteEmbedView' => 'AphrontView', 'SlowvoteInfoConduitAPIMethod' => 'SlowvoteConduitAPIMethod', 'SlowvoteRemarkupRule' => 'PhabricatorObjectRemarkupRule', + 'SlowvoteSearchConduitAPIMethod' => 'PhabricatorSearchEngineAPIMethod', 'SubscriptionListDialogBuilder' => 'Phobject', 'SubscriptionListStringBuilder' => 'Phobject', 'TokenConduitAPIMethod' => 'ConduitAPIMethod', diff --git a/src/applications/slowvote/conduit/SlowvoteSearchConduitAPIMethod.php b/src/applications/slowvote/conduit/SlowvoteSearchConduitAPIMethod.php new file mode 100644 --- /dev/null +++ b/src/applications/slowvote/conduit/SlowvoteSearchConduitAPIMethod.php @@ -0,0 +1,18 @@ +setKey('authorPHIDs') ->setAliases(array('authors')) ->setLabel(pht('Authors')), - id(new PhabricatorSearchCheckboxesField()) ->setKey('voted') + ->setLabel(pht('Voted')) + + // TODO: This should probably become a list of "voterPHIDs", so hide + // the field from Conduit to avoid a backward compatibility break when + // this changes. + + ->setEnableForConduit(false) ->setOptions(array( 'voted' => pht("Show only polls I've voted in."), )), - id(new PhabricatorSearchCheckboxesField()) ->setKey('statuses') ->setLabel(pht('Statuses')) - ->setOptions(array( + ->setOptions( + array( 'open' => pht('Open'), 'closed' => pht('Closed'), - )), + )), ); } 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 @@ -9,7 +9,8 @@ PhabricatorTokenReceiverInterface, PhabricatorProjectInterface, PhabricatorDestructibleInterface, - PhabricatorSpacesInterface { + PhabricatorSpacesInterface, + PhabricatorConduitResultInterface { const RESPONSES_VISIBLE = 0; const RESPONSES_VOTERS = 1; @@ -202,10 +203,36 @@ $this->saveTransaction(); } - /* -( PhabricatorSpacesInterface )--------------------------------------- */ +/* -( PhabricatorSpacesInterface )----------------------------------------- */ public function getSpacePHID() { return $this->spacePHID; } +/* -( PhabricatorConduitResultInterface )---------------------------------- */ + + public function getFieldSpecificationsForConduit() { + return array( + id(new PhabricatorConduitSearchFieldSpecification()) + ->setKey('name') + ->setType('string') + ->setDescription(pht('The name of the poll.')), + id(new PhabricatorConduitSearchFieldSpecification()) + ->setKey('authorPHID') + ->setType('string') + ->setDescription(pht('The author of the poll.')), + ); + } + + public function getFieldValuesForConduit() { + return array( + 'name' => $this->getQuestion(), + 'authorPHID' => $this->getAuthorPHID(), + ); + } + + public function getConduitSearchAttachments() { + return array(); + } + }