Page MenuHomePhabricator

D16507.id.diff
No OneTemporary

D16507.id.diff

diff --git a/src/applications/conduit/parametertype/ConduitParameterType.php b/src/applications/conduit/parametertype/ConduitParameterType.php
--- a/src/applications/conduit/parametertype/ConduitParameterType.php
+++ b/src/applications/conduit/parametertype/ConduitParameterType.php
@@ -38,6 +38,9 @@
return $this->getParameterValue($request, $key);
}
+ final public function getKeys($key) {
+ return $this->getParameterKeys($key);
+ }
final public function getDefaultValue() {
return $this->getParameterDefault();
@@ -86,6 +89,10 @@
return $request[$key];
}
+ protected function getParameterKeys($key) {
+ return array($key);
+ }
+
abstract protected function getParameterTypeName();
diff --git a/src/applications/search/engine/PhabricatorApplicationSearchEngine.php b/src/applications/search/engine/PhabricatorApplicationSearchEngine.php
--- a/src/applications/search/engine/PhabricatorApplicationSearchEngine.php
+++ b/src/applications/search/engine/PhabricatorApplicationSearchEngine.php
@@ -1094,6 +1094,22 @@
}
}
+ $valid_constraints = array();
+ foreach ($fields as $field) {
+ foreach ($field->getValidConstraintKeys() as $key) {
+ $valid_constraints[$key] = true;
+ }
+ }
+
+ foreach ($constraints as $key => $constraint) {
+ if (empty($valid_constraints[$key])) {
+ throw new Exception(
+ pht(
+ 'Constraint "%s" is not a valid constraint for this query.',
+ $key));
+ }
+ }
+
foreach ($fields as $field) {
if (!$field->getValueExistsInConduitRequest($constraints)) {
continue;
diff --git a/src/applications/search/field/PhabricatorSearchField.php b/src/applications/search/field/PhabricatorSearchField.php
--- a/src/applications/search/field/PhabricatorSearchField.php
+++ b/src/applications/search/field/PhabricatorSearchField.php
@@ -329,6 +329,11 @@
$this->getConduitKey());
}
+ public function getValidConstraintKeys() {
+ return $this->getConduitParameterType()->getKeys(
+ $this->getConduitKey());
+ }
+
/* -( Utility Methods )----------------------------------------------------- */

File Metadata

Mime Type
text/plain
Expires
Thu, Apr 3, 2:14 AM (2 d, 4 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7691845
Default Alt Text
D16507.id.diff (2 KB)

Event Timeline