Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14414461
D12523.id30082.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
12 KB
Referenced Files
None
Subscribers
None
D12523.id30082.diff
View Options
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
@@ -1033,8 +1033,6 @@
'ManiphestInfoConduitAPIMethod' => 'applications/maniphest/conduit/ManiphestInfoConduitAPIMethod.php',
'ManiphestNameIndex' => 'applications/maniphest/storage/ManiphestNameIndex.php',
'ManiphestNameIndexEventListener' => 'applications/maniphest/event/ManiphestNameIndexEventListener.php',
- 'ManiphestNoOwnerDatasource' => 'applications/maniphest/typeahead/ManiphestNoOwnerDatasource.php',
- 'ManiphestOwnerDatasource' => 'applications/maniphest/typeahead/ManiphestOwnerDatasource.php',
'ManiphestPriorityEmailCommand' => 'applications/maniphest/command/ManiphestPriorityEmailCommand.php',
'ManiphestQueryConduitAPIMethod' => 'applications/maniphest/conduit/ManiphestQueryConduitAPIMethod.php',
'ManiphestQueryStatusesConduitAPIMethod' => 'applications/maniphest/conduit/ManiphestQueryStatusesConduitAPIMethod.php',
@@ -2207,6 +2205,8 @@
'PhabricatorPeopleLogSearchEngine' => 'applications/people/query/PhabricatorPeopleLogSearchEngine.php',
'PhabricatorPeopleLogsController' => 'applications/people/controller/PhabricatorPeopleLogsController.php',
'PhabricatorPeopleNewController' => 'applications/people/controller/PhabricatorPeopleNewController.php',
+ 'PhabricatorPeopleNoOwnerDatasource' => 'applications/people/typeahead/PhabricatorPeopleNoOwnerDatasource.php',
+ 'PhabricatorPeopleOwnerDatasource' => 'applications/people/typeahead/PhabricatorPeopleOwnerDatasource.php',
'PhabricatorPeopleProfileController' => 'applications/people/controller/PhabricatorPeopleProfileController.php',
'PhabricatorPeopleProfileEditController' => 'applications/people/controller/PhabricatorPeopleProfileEditController.php',
'PhabricatorPeopleProfilePictureController' => 'applications/people/controller/PhabricatorPeopleProfilePictureController.php',
@@ -4309,8 +4309,6 @@
'ManiphestInfoConduitAPIMethod' => 'ManiphestConduitAPIMethod',
'ManiphestNameIndex' => 'ManiphestDAO',
'ManiphestNameIndexEventListener' => 'PhabricatorEventListener',
- 'ManiphestNoOwnerDatasource' => 'PhabricatorTypeaheadDatasource',
- 'ManiphestOwnerDatasource' => 'PhabricatorTypeaheadCompositeDatasource',
'ManiphestPriorityEmailCommand' => 'ManiphestEmailCommand',
'ManiphestQueryConduitAPIMethod' => 'ManiphestConduitAPIMethod',
'ManiphestQueryStatusesConduitAPIMethod' => 'ManiphestConduitAPIMethod',
@@ -5575,6 +5573,8 @@
'PhabricatorPeopleLogSearchEngine' => 'PhabricatorApplicationSearchEngine',
'PhabricatorPeopleLogsController' => 'PhabricatorPeopleController',
'PhabricatorPeopleNewController' => 'PhabricatorPeopleController',
+ 'PhabricatorPeopleNoOwnerDatasource' => 'PhabricatorTypeaheadDatasource',
+ 'PhabricatorPeopleOwnerDatasource' => 'PhabricatorTypeaheadCompositeDatasource',
'PhabricatorPeopleProfileController' => 'PhabricatorPeopleController',
'PhabricatorPeopleProfileEditController' => 'PhabricatorPeopleController',
'PhabricatorPeopleProfilePictureController' => 'PhabricatorPeopleController',
diff --git a/src/applications/maniphest/controller/ManiphestBatchEditController.php b/src/applications/maniphest/controller/ManiphestBatchEditController.php
--- a/src/applications/maniphest/controller/ManiphestBatchEditController.php
+++ b/src/applications/maniphest/controller/ManiphestBatchEditController.php
@@ -265,8 +265,8 @@
continue 2;
}
$value = head($value);
- $no_owner = ManiphestNoOwnerDatasource::FUNCTION_TOKEN;
- if ($value === ManiphestNoOwnerDatasource::FUNCTION_TOKEN) {
+ $no_owner = PhabricatorPeopleNoOwnerDatasource::FUNCTION_TOKEN;
+ if ($value === $no_owner) {
$value = null;
}
break;
diff --git a/src/applications/maniphest/query/ManiphestTaskQuery.php b/src/applications/maniphest/query/ManiphestTaskQuery.php
--- a/src/applications/maniphest/query/ManiphestTaskQuery.php
+++ b/src/applications/maniphest/query/ManiphestTaskQuery.php
@@ -75,7 +75,7 @@
}
public function withOwners(array $owners) {
- $no_owner = ManiphestNoOwnerDatasource::FUNCTION_TOKEN;
+ $no_owner = PhabricatorPeopleNoOwnerDatasource::FUNCTION_TOKEN;
$this->includeUnowned = false;
foreach ($owners as $k => $phid) {
diff --git a/src/applications/maniphest/query/ManiphestTaskSearchEngine.php b/src/applications/maniphest/query/ManiphestTaskSearchEngine.php
--- a/src/applications/maniphest/query/ManiphestTaskSearchEngine.php
+++ b/src/applications/maniphest/query/ManiphestTaskSearchEngine.php
@@ -137,7 +137,7 @@
$query->withSubscribers($subscriber_phids);
}
- $datasource = id(new ManiphestOwnerDatasource())
+ $datasource = id(new PhabricatorPeopleOwnerDatasource())
->setViewer($this->requireViewer());
$assigned_phids = $this->readAssignedPHIDs($saved);
@@ -311,7 +311,7 @@
$form
->appendControl(
id(new AphrontFormTokenizerControl())
- ->setDatasource(new ManiphestOwnerDatasource())
+ ->setDatasource(new PhabricatorPeopleOwnerDatasource())
->setName('assigned')
->setLabel(pht('Assigned To'))
->setValue($assigned_phids))
@@ -560,7 +560,7 @@
// typeaheads, and is retained for compatibility. We could remove it by
// migrating old saved queries.
if ($saved->getParameter('withUnassigned')) {
- $assigned_phids[] = ManiphestNoOwnerDatasource::FUNCTION_TOKEN;
+ $assigned_phids[] = PhabricatorPeopleNoOwnerDatasource::FUNCTION_TOKEN;
}
return $assigned_phids;
diff --git a/src/applications/maniphest/typeahead/ManiphestAssigneeDatasource.php b/src/applications/maniphest/typeahead/ManiphestAssigneeDatasource.php
--- a/src/applications/maniphest/typeahead/ManiphestAssigneeDatasource.php
+++ b/src/applications/maniphest/typeahead/ManiphestAssigneeDatasource.php
@@ -14,7 +14,7 @@
public function getComponentDatasources() {
return array(
new PhabricatorPeopleDatasource(),
- new ManiphestNoOwnerDatasource(),
+ new PhabricatorPeopleNoOwnerDatasource(),
);
}
diff --git a/src/applications/maniphest/typeahead/ManiphestNoOwnerDatasource.php b/src/applications/people/typeahead/PhabricatorPeopleNoOwnerDatasource.php
rename from src/applications/maniphest/typeahead/ManiphestNoOwnerDatasource.php
rename to src/applications/people/typeahead/PhabricatorPeopleNoOwnerDatasource.php
--- a/src/applications/maniphest/typeahead/ManiphestNoOwnerDatasource.php
+++ b/src/applications/people/typeahead/PhabricatorPeopleNoOwnerDatasource.php
@@ -1,6 +1,6 @@
<?php
-final class ManiphestNoOwnerDatasource
+final class PhabricatorPeopleNoOwnerDatasource
extends PhabricatorTypeaheadDatasource {
const FUNCTION_TOKEN = 'none()';
@@ -14,7 +14,7 @@
}
public function getDatasourceApplicationClass() {
- return 'PhabricatorManiphestApplication';
+ return 'PhabricatorPeopleApplication';
}
public function getDatasourceFunctions() {
diff --git a/src/applications/maniphest/typeahead/ManiphestOwnerDatasource.php b/src/applications/people/typeahead/PhabricatorPeopleOwnerDatasource.php
rename from src/applications/maniphest/typeahead/ManiphestOwnerDatasource.php
rename to src/applications/people/typeahead/PhabricatorPeopleOwnerDatasource.php
--- a/src/applications/maniphest/typeahead/ManiphestOwnerDatasource.php
+++ b/src/applications/people/typeahead/PhabricatorPeopleOwnerDatasource.php
@@ -1,6 +1,6 @@
<?php
-final class ManiphestOwnerDatasource
+final class PhabricatorPeopleOwnerDatasource
extends PhabricatorTypeaheadCompositeDatasource {
public function getBrowseTitle() {
@@ -14,7 +14,7 @@
public function getComponentDatasources() {
return array(
new PhabricatorViewerDatasource(),
- new ManiphestNoOwnerDatasource(),
+ new PhabricatorPeopleNoOwnerDatasource(),
new PhabricatorPeopleDatasource(),
new PhabricatorProjectMembersDatasource(),
);
diff --git a/src/applications/project/typeahead/PhabricatorProjectMembersDatasource.php b/src/applications/project/typeahead/PhabricatorProjectMembersDatasource.php
--- a/src/applications/project/typeahead/PhabricatorProjectMembersDatasource.php
+++ b/src/applications/project/typeahead/PhabricatorProjectMembersDatasource.php
@@ -79,6 +79,9 @@
$tokens = $this->renderTokens($phids);
foreach ($tokens as $token) {
+ // Remove any project color on this token.
+ $token->setColor(null);
+
if ($token->isInvalid()) {
$token
->setValue(pht('Members: Invalid Project'));
diff --git a/src/applications/search/query/PhabricatorSearchApplicationSearchEngine.php b/src/applications/search/query/PhabricatorSearchApplicationSearchEngine.php
--- a/src/applications/search/query/PhabricatorSearchApplicationSearchEngine.php
+++ b/src/applications/search/query/PhabricatorSearchApplicationSearchEngine.php
@@ -31,10 +31,6 @@
$this->readUsersFromRequest($request, 'ownerPHIDs'));
$saved->setParameter(
- 'withUnowned',
- $this->readBoolFromRequest($request, 'withUnowned'));
-
- $saved->setParameter(
'subscriberPHIDs',
$this->readPHIDsFromRequest($request, 'subscriberPHIDs'));
@@ -46,8 +42,34 @@
}
public function buildQueryFromSavedQuery(PhabricatorSavedQuery $saved) {
- $query = id(new PhabricatorSearchDocumentQuery())
- ->withSavedQuery($saved);
+ $query = new PhabricatorSearchDocumentQuery();
+
+ // Convert the saved query into a resolved form (without typeahead
+ // functions) which the fulltext search engines can execute.
+ $config = clone $saved;
+ $viewer = $this->requireViewer();
+
+ $datasource = id(new PhabricatorPeopleOwnerDatasource())
+ ->setViewer($viewer);
+ $owner_phids = $this->readOwnerPHIDs($config);
+ $owner_phids = $datasource->evaluateTokens($owner_phids);
+ foreach ($owner_phids as $key => $phid) {
+ if ($phid == PhabricatorPeopleNoOwnerDatasource::FUNCTION_TOKEN) {
+ $config->setParameter('withUnowned', true);
+ unset($owner_phids[$key]);
+ }
+ }
+ $config->setParameter('ownerPHIDs', $owner_phids);
+
+
+ $datasource = id(new PhabricatorTypeaheadUserParameterizedDatasource())
+ ->setViewer($viewer);
+ $author_phids = $config->getParameter('authorPHIDs', array());
+ $author_phids = $datasource->evaluateTokens($author_phids);
+ $config->setParameter('authorPHIDs', $author_phids);
+
+ $query->withSavedQuery($config);
+
return $query;
}
@@ -62,12 +84,10 @@
$project_value = null;
$author_phids = $saved->getParameter('authorPHIDs', array());
- $owner_phids = $saved->getParameter('ownerPHIDs', array());
+ $owner_phids = $this->readOwnerPHIDs($saved);
$subscriber_phids = $saved->getParameter('subscriberPHIDs', array());
$project_phids = $saved->getParameter('projectPHIDs', array());
- $with_unowned = $saved->getParameter('withUnowned', array());
-
$status_values = $saved->getParameter('statuses', array());
$status_values = array_fuse($status_values);
@@ -114,26 +134,19 @@
id(new AphrontFormTokenizerControl())
->setName('authorPHIDs')
->setLabel('Authors')
- ->setDatasource(new PhabricatorPeopleDatasource())
+ ->setDatasource(new PhabricatorTypeaheadUserParameterizedDatasource())
->setValue($author_phids))
->appendControl(
id(new AphrontFormTokenizerControl())
->setName('ownerPHIDs')
->setLabel('Owners')
- ->setDatasource(new ManiphestOwnerDatasource())
+ ->setDatasource(new PhabricatorPeopleOwnerDatasource())
->setValue($owner_phids))
- ->appendChild(
- id(new AphrontFormCheckboxControl())
- ->addCheckbox(
- 'withUnowned',
- 1,
- pht('Show only unowned documents.'),
- $with_unowned))
->appendControl(
id(new AphrontFormTokenizerControl())
->setName('subscriberPHIDs')
->setLabel('Subscribers')
- ->setDatasource(new PhabricatorPeopleDatasource())
+ ->setDatasource(new PhabricatorMetaMTAMailableDatasource())
->setValue($subscriber_phids))
->appendControl(
id(new AphrontFormTokenizerControl())
@@ -242,4 +255,15 @@
return $results;
}
+ private function readOwnerPHIDs(PhabricatorSavedQuery $saved) {
+ $owner_phids = $saved->getParameter('ownerPHIDs', array());
+
+ // This was an old checkbox from before typeahead functions.
+ if ($saved->getParameter('withUnowned')) {
+ $owner_phids[] = PhabricatorPeopleNoOwnerDatasource::FUNCTION_TOKEN;
+ }
+
+ return $owner_phids;
+ }
+
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Dec 25, 3:41 PM (11 h, 54 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6926965
Default Alt Text
D12523.id30082.diff (12 KB)
Attached To
Mode
D12523: Refine global search UI for tokenizer functions
Attached
Detach File
Event Timeline
Log In to Comment