Page MenuHomePhabricator

D20685.id.diff
No OneTemporary

D20685.id.diff

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 @@
+<?php
+
+final class SlowvoteSearchConduitAPIMethod
+ extends PhabricatorSearchEngineAPIMethod {
+
+ public function getAPIMethodName() {
+ return 'slowvote.poll.search';
+ }
+
+ public function newSearchEngine() {
+ return new PhabricatorSlowvoteSearchEngine();
+ }
+
+ public function getMethodSummary() {
+ return pht('Read information about polls.');
+ }
+
+}
diff --git a/src/applications/slowvote/query/PhabricatorSlowvoteSearchEngine.php b/src/applications/slowvote/query/PhabricatorSlowvoteSearchEngine.php
--- a/src/applications/slowvote/query/PhabricatorSlowvoteSearchEngine.php
+++ b/src/applications/slowvote/query/PhabricatorSlowvoteSearchEngine.php
@@ -46,20 +46,26 @@
->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();
+ }
+
}

File Metadata

Mime Type
text/plain
Expires
Wed, Apr 9, 2:04 PM (3 w, 6 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7434891
Default Alt Text
D20685.id.diff (5 KB)

Event Timeline