Page MenuHomePhabricator

D19128.id45832.diff
No OneTemporary

D19128.id45832.diff

diff --git a/src/applications/typeahead/controller/PhabricatorTypeaheadFunctionHelpController.php b/src/applications/typeahead/controller/PhabricatorTypeaheadFunctionHelpController.php
--- a/src/applications/typeahead/controller/PhabricatorTypeaheadFunctionHelpController.php
+++ b/src/applications/typeahead/controller/PhabricatorTypeaheadFunctionHelpController.php
@@ -19,9 +19,25 @@
return new Aphront404Response();
}
- $source = $sources[$class];
+ $raw_parameters = $request->getStr('parameters');
+ if ($raw_parameters) {
+ $parameters = phutil_json_decode($raw_parameters);
+ } else {
+ $parameters = array();
+ }
+
+ $source = id(clone $sources[$class])
+ ->setParameters($parameters);
+
+ // This can fail for some types of datasources (like the custom field proxy
+ // datasources) if the "parameters" are wrong. Just fail cleanly instead
+ // of fataling.
+ try {
+ $application_class = $source->getDatasourceApplicationClass();
+ } catch (Exception $ex) {
+ return new Aphront404Response();
+ }
- $application_class = $source->getDatasourceApplicationClass();
if ($application_class) {
$result = id(new PhabricatorApplicationQuery())
->setViewer($this->getViewer())
diff --git a/src/applications/typeahead/controller/PhabricatorTypeaheadModularDatasourceController.php b/src/applications/typeahead/controller/PhabricatorTypeaheadModularDatasourceController.php
--- a/src/applications/typeahead/controller/PhabricatorTypeaheadModularDatasourceController.php
+++ b/src/applications/typeahead/controller/PhabricatorTypeaheadModularDatasourceController.php
@@ -226,6 +226,12 @@
if ($source->getAllDatasourceFunctions()) {
$reference_uri = '/typeahead/help/'.get_class($source).'/';
+ $parameters = $source->getParameters();
+ if ($parameters) {
+ $reference_uri = (string)id(new PhutilURI($reference_uri))
+ ->setQueryParam('parameters', phutil_json_encode($parameters));
+ }
+
$reference_link = phutil_tag(
'a',
array(
diff --git a/src/infrastructure/customfield/datasource/PhabricatorCustomFieldApplicationSearchAnyFunctionDatasource.php b/src/infrastructure/customfield/datasource/PhabricatorCustomFieldApplicationSearchAnyFunctionDatasource.php
--- a/src/infrastructure/customfield/datasource/PhabricatorCustomFieldApplicationSearchAnyFunctionDatasource.php
+++ b/src/infrastructure/customfield/datasource/PhabricatorCustomFieldApplicationSearchAnyFunctionDatasource.php
@@ -22,7 +22,7 @@
'summary' => pht('Find results with any value.'),
'description' => pht(
"This function includes results which have any value. Use a query ".
- "like this to find results with any value:\n\n%s".
+ "like this to find results with any value:\n\n%s",
'> any()'),
),
);

File Metadata

Mime Type
text/plain
Expires
Mon, Mar 24, 1:19 PM (6 d, 17 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7394681
Default Alt Text
D19128.id45832.diff (2 KB)

Event Timeline