Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F13209108
D12307.id29572.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D12307.id29572.diff
View Options
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
@@ -3,17 +3,11 @@
final class PhabricatorTypeaheadModularDatasourceController
extends PhabricatorTypeaheadDatasourceController {
- private $class;
-
public function shouldAllowPublic() {
return true;
}
- public function willProcessRequest(array $data) {
- $this->class = idx($data, 'class');
- }
-
- public function processRequest() {
+ public function handleRequest(AphrontRequest $request) {
$request = $this->getRequest();
$viewer = $request->getUser();
$query = $request->getStr('q');
@@ -22,14 +16,21 @@
$raw_query = nonempty($request->getStr('raw'), $query);
// This makes form submission easier in the debug view.
- $this->class = nonempty($request->getStr('class'), $this->class);
+ $class = nonempty($request->getURIData('class'), $request->getStr('class'));
$sources = id(new PhutilSymbolLoader())
->setAncestorClass('PhabricatorTypeaheadDatasource')
->loadObjects();
+ if (isset($sources[$class])) {
+ $source = $sources[$class];
+ if ($source->getDatasourceApplicationClass()) {
+ if (!PhabricatorApplication::isClassInstalledForViewer(
+ $source->getDatasourceApplicationClass(),
+ $viewer)) {
+ return id(new Aphront404Response());
+ }
+ }
- if (isset($sources[$this->class])) {
- $source = $sources[$this->class];
$source->setParameters($request->getRequestData());
$composite = new PhabricatorTypeaheadRuntimeCompositeDatasource();
@@ -54,6 +55,18 @@
// If there's a non-Ajax request to this endpoint, show results in a tabular
// format to make it easier to debug typeahead output.
+ foreach ($sources as $key => $source) {
+ // This can happen with composite sources like user or project, as well
+ // generic ones like NoOwner
+ if (!$source->getDatasourceApplicationClass()) {
+ continue;
+ }
+ if (!PhabricatorApplication::isClassInstalledForViewer(
+ $source->getDatasourceApplicationClass(),
+ $viewer)) {
+ unset($sources[$key]);
+ }
+ }
$options = array_fuse(array_keys($sources));
asort($options);
@@ -64,7 +77,7 @@
id(new AphrontFormSelectControl())
->setLabel(pht('Source Class'))
->setName('class')
- ->setValue($this->class)
+ ->setValue($class)
->setOptions($options))
->appendChild(
id(new AphrontFormTextControl())
@@ -101,7 +114,7 @@
));
$result_box = id(new PHUIObjectBoxView())
- ->setHeaderText(pht('Token Results (%s)', $this->class))
+ ->setHeaderText(pht('Token Results (%s)', $class))
->appendChild($table);
return $this->buildApplicationPage(
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, May 17, 9:47 PM (2 w, 2 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6281722
Default Alt Text
D12307.id29572.diff (3 KB)
Attached To
Mode
D12307: Typeahead - filter typeaheads that the viewer can't see in typeahead debug tool
Attached
Detach File
Event Timeline
Log In to Comment