Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F13989860
D12470.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
16 KB
Referenced Files
None
Subscribers
None
D12470.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
@@ -998,6 +998,7 @@
'MacroCreateMemeConduitAPIMethod' => 'applications/macro/conduit/MacroCreateMemeConduitAPIMethod.php',
'MacroQueryConduitAPIMethod' => 'applications/macro/conduit/MacroQueryConduitAPIMethod.php',
'ManiphestAssignEmailCommand' => 'applications/maniphest/command/ManiphestAssignEmailCommand.php',
+ 'ManiphestAssigneeDatasource' => 'applications/maniphest/typeahead/ManiphestAssigneeDatasource.php',
'ManiphestBatchEditController' => 'applications/maniphest/controller/ManiphestBatchEditController.php',
'ManiphestBulkEditCapability' => 'applications/maniphest/capability/ManiphestBulkEditCapability.php',
'ManiphestClaimEmailCommand' => 'applications/maniphest/command/ManiphestClaimEmailCommand.php',
@@ -1031,6 +1032,8 @@
'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',
@@ -2639,8 +2642,6 @@
'PhabricatorTypeaheadInvalidTokenException' => 'applications/typeahead/exception/PhabricatorTypeaheadInvalidTokenException.php',
'PhabricatorTypeaheadModularDatasourceController' => 'applications/typeahead/controller/PhabricatorTypeaheadModularDatasourceController.php',
'PhabricatorTypeaheadMonogramDatasource' => 'applications/typeahead/datasource/PhabricatorTypeaheadMonogramDatasource.php',
- 'PhabricatorTypeaheadNoOwnerDatasource' => 'applications/typeahead/datasource/PhabricatorTypeaheadNoOwnerDatasource.php',
- 'PhabricatorTypeaheadOwnerDatasource' => 'applications/typeahead/datasource/PhabricatorTypeaheadOwnerDatasource.php',
'PhabricatorTypeaheadResult' => 'applications/typeahead/storage/PhabricatorTypeaheadResult.php',
'PhabricatorTypeaheadRuntimeCompositeDatasource' => 'applications/typeahead/datasource/PhabricatorTypeaheadRuntimeCompositeDatasource.php',
'PhabricatorTypeaheadTokenView' => 'applications/typeahead/view/PhabricatorTypeaheadTokenView.php',
@@ -4270,6 +4271,7 @@
'MacroCreateMemeConduitAPIMethod' => 'MacroConduitAPIMethod',
'MacroQueryConduitAPIMethod' => 'MacroConduitAPIMethod',
'ManiphestAssignEmailCommand' => 'ManiphestEmailCommand',
+ 'ManiphestAssigneeDatasource' => 'PhabricatorTypeaheadCompositeDatasource',
'ManiphestBatchEditController' => 'ManiphestController',
'ManiphestBulkEditCapability' => 'PhabricatorPolicyCapability',
'ManiphestClaimEmailCommand' => 'ManiphestEmailCommand',
@@ -4304,6 +4306,8 @@
'ManiphestInfoConduitAPIMethod' => 'ManiphestConduitAPIMethod',
'ManiphestNameIndex' => 'ManiphestDAO',
'ManiphestNameIndexEventListener' => 'PhabricatorEventListener',
+ 'ManiphestNoOwnerDatasource' => 'PhabricatorTypeaheadDatasource',
+ 'ManiphestOwnerDatasource' => 'PhabricatorTypeaheadCompositeDatasource',
'ManiphestPriorityEmailCommand' => 'ManiphestEmailCommand',
'ManiphestQueryConduitAPIMethod' => 'ManiphestConduitAPIMethod',
'ManiphestQueryStatusesConduitAPIMethod' => 'ManiphestConduitAPIMethod',
@@ -6053,8 +6057,6 @@
'PhabricatorTypeaheadInvalidTokenException' => 'Exception',
'PhabricatorTypeaheadModularDatasourceController' => 'PhabricatorTypeaheadDatasourceController',
'PhabricatorTypeaheadMonogramDatasource' => 'PhabricatorTypeaheadDatasource',
- 'PhabricatorTypeaheadNoOwnerDatasource' => 'PhabricatorTypeaheadDatasource',
- 'PhabricatorTypeaheadOwnerDatasource' => 'PhabricatorTypeaheadCompositeDatasource',
'PhabricatorTypeaheadRuntimeCompositeDatasource' => 'PhabricatorTypeaheadCompositeDatasource',
'PhabricatorTypeaheadTokenView' => 'AphrontTagView',
'PhabricatorTypeaheadUserParameterizedDatasource' => 'PhabricatorTypeaheadCompositeDatasource',
diff --git a/src/applications/maniphest/constants/ManiphestTaskOwner.php b/src/applications/maniphest/constants/ManiphestTaskOwner.php
--- a/src/applications/maniphest/constants/ManiphestTaskOwner.php
+++ b/src/applications/maniphest/constants/ManiphestTaskOwner.php
@@ -2,7 +2,6 @@
final class ManiphestTaskOwner extends ManiphestConstants {
- const OWNER_UP_FOR_GRABS = 'PHID-!!!!-UP-FOR-GRABS';
const PROJECT_NO_PROJECT = 'PHID-!!!!-NO-PROJECT';
}
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
@@ -86,7 +86,7 @@
$projects_source = new PhabricatorProjectDatasource();
$mailable_source = new PhabricatorMetaMTAMailableDatasource();
$mailable_source->setViewer($viewer);
- $owner_source = new PhabricatorTypeaheadOwnerDatasource();
+ $owner_source = new ManiphestAssigneeDatasource();
$owner_source->setViewer($viewer);
require_celerity_resource('maniphest-batch-editor');
@@ -265,7 +265,8 @@
continue 2;
}
$value = head($value);
- if ($value === ManiphestTaskOwner::OWNER_UP_FOR_GRABS) {
+ $no_owner = ManiphestNoOwnerDatasource::FUNCTION_TOKEN;
+ if ($value === ManiphestNoOwnerDatasource::FUNCTION_TOKEN) {
$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
@@ -73,9 +73,11 @@
}
public function withOwners(array $owners) {
+ $no_owner = ManiphestNoOwnerDatasource::FUNCTION_TOKEN;
+
$this->includeUnowned = false;
foreach ($owners as $k => $phid) {
- if ($phid == ManiphestTaskOwner::OWNER_UP_FOR_GRABS || $phid === null) {
+ if ($phid === $no_owner || $phid === null) {
$this->includeUnowned = true;
unset($owners[$k]);
break;
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
@@ -49,8 +49,6 @@
'assignedPHIDs',
$this->readUsersFromRequest($request, 'assigned'));
- $saved->setParameter('withUnassigned', $request->getBool('withUnassigned'));
-
$saved->setParameter(
'authorPHIDs',
$this->readUsersFromRequest($request, 'authors'));
@@ -139,14 +137,13 @@
$query->withSubscribers($subscriber_phids);
}
- $with_unassigned = $saved->getParameter('withUnassigned');
- if ($with_unassigned) {
- $query->withOwners(array(null));
- } else {
- $assigned_phids = $saved->getParameter('assignedPHIDs', array());
- if ($assigned_phids) {
- $query->withOwners($assigned_phids);
- }
+ $datasource = id(new ManiphestOwnerDatasource())
+ ->setViewer($this->requireViewer());
+
+ $assigned_phids = $this->readAssignedPHIDs($saved);
+ $assigned_phids = $datasource->evaluateTokens($assigned_phids);
+ if ($assigned_phids) {
+ $query->withOwners($assigned_phids);
}
$statuses = $saved->getParameter('statuses');
@@ -242,7 +239,8 @@
AphrontFormView $form,
PhabricatorSavedQuery $saved) {
- $assigned_phids = $saved->getParameter('assignedPHIDs', array());
+ $assigned_phids = $this->readAssignedPHIDs($saved);
+
$author_phids = $saved->getParameter('authorPHIDs', array());
$all_project_phids = $saved->getParameter(
'allProjectPHIDs',
@@ -258,7 +256,6 @@
array());
$subscriber_phids = $saved->getParameter('subscriberPHIDs', array());
- $with_unassigned = $saved->getParameter('withUnassigned');
$with_no_projects = $saved->getParameter('withNoProject');
$statuses = $saved->getParameter('statuses', array());
@@ -314,17 +311,10 @@
$form
->appendControl(
id(new AphrontFormTokenizerControl())
- ->setDatasource(new PhabricatorPeopleDatasource())
+ ->setDatasource(new ManiphestOwnerDatasource())
->setName('assigned')
->setLabel(pht('Assigned To'))
->setValue($assigned_phids))
- ->appendChild(
- id(new AphrontFormCheckboxControl())
- ->addCheckbox(
- 'withUnassigned',
- 1,
- pht('Show only unassigned tasks.'),
- $with_unassigned))
->appendControl(
id(new AphrontFormTokenizerControl())
->setDatasource(new PhabricatorProjectDatasource())
@@ -563,4 +553,17 @@
->setShowBatchControls($this->showBatchControls);
}
+ private function readAssignedPHIDs(PhabricatorSavedQuery $saved) {
+ $assigned_phids = $saved->getParameter('assignedPHIDs', array());
+
+ // This may be present in old saved queries from before parameterized
+ // typeaheads, and is retained for compatibility. We could remove it by
+ // migrating old saved queries.
+ if ($saved->getParameter('withUnassigned')) {
+ $assigned_phids[] = ManiphestNoOwnerDatasource::FUNCTION_TOKEN;
+ }
+
+ return $assigned_phids;
+ }
+
}
diff --git a/src/applications/typeahead/datasource/PhabricatorTypeaheadOwnerDatasource.php b/src/applications/maniphest/typeahead/ManiphestAssigneeDatasource.php
rename from src/applications/typeahead/datasource/PhabricatorTypeaheadOwnerDatasource.php
rename to src/applications/maniphest/typeahead/ManiphestAssigneeDatasource.php
--- a/src/applications/typeahead/datasource/PhabricatorTypeaheadOwnerDatasource.php
+++ b/src/applications/maniphest/typeahead/ManiphestAssigneeDatasource.php
@@ -1,20 +1,20 @@
<?php
-final class PhabricatorTypeaheadOwnerDatasource
+final class ManiphestAssigneeDatasource
extends PhabricatorTypeaheadCompositeDatasource {
public function getBrowseTitle() {
- return pht('Browse Owners');
+ return pht('Browse Assignees');
}
public function getPlaceholderText() {
- return pht('Type a user name or "none"...');
+ return pht('Type a username or "none"...');
}
public function getComponentDatasources() {
return array(
new PhabricatorPeopleDatasource(),
- new PhabricatorTypeaheadNoOwnerDatasource(),
+ new ManiphestNoOwnerDatasource(),
);
}
diff --git a/src/applications/maniphest/typeahead/ManiphestNoOwnerDatasource.php b/src/applications/maniphest/typeahead/ManiphestNoOwnerDatasource.php
new file mode 100644
--- /dev/null
+++ b/src/applications/maniphest/typeahead/ManiphestNoOwnerDatasource.php
@@ -0,0 +1,64 @@
+<?php
+
+final class ManiphestNoOwnerDatasource
+ extends PhabricatorTypeaheadDatasource {
+
+ const FUNCTION_TOKEN = 'none()';
+
+ public function getBrowseTitle() {
+ return pht('Browse No Owner');
+ }
+
+ public function getPlaceholderText() {
+ return pht('Type "none"...');
+ }
+
+ public function getDatasourceApplicationClass() {
+ return 'PhabricatorManiphestApplication';
+ }
+
+ public function getDatasourceFunctions() {
+ return array(
+ 'none' => array(
+ 'name' => pht('Find results which are not assigned.'),
+ ),
+ );
+ }
+
+ public function loadResults() {
+ $results = array(
+ $this->buildNoOwnerResult(),
+ );
+ return $this->filterResultsAgainstTokens($results);
+ }
+
+ protected function evaluateFunction($function, array $argv_list) {
+ $results = array();
+
+ foreach ($argv_list as $argv) {
+ $results[] = self::FUNCTION_TOKEN;
+ }
+
+ return $results;
+ }
+
+ public function renderFunctionTokens($function, array $argv_list) {
+ $results = array();
+ foreach ($argv_list as $argv) {
+ $results[] = PhabricatorTypeaheadTokenView::newFromTypeaheadResult(
+ $this->buildNoOwnerResult());
+ }
+ return $results;
+ }
+
+ private function buildNoOwnerResult() {
+ $name = pht('No Owner');
+ return $this->newFunctionResult()
+ ->setName($name.' none')
+ ->setDisplayName($name)
+ ->setIcon('fa-ban')
+ ->setPHID('none()')
+ ->setUnique(true);
+ }
+
+}
diff --git a/src/applications/typeahead/datasource/PhabricatorTypeaheadOwnerDatasource.php b/src/applications/maniphest/typeahead/ManiphestOwnerDatasource.php
rename from src/applications/typeahead/datasource/PhabricatorTypeaheadOwnerDatasource.php
rename to src/applications/maniphest/typeahead/ManiphestOwnerDatasource.php
--- a/src/applications/typeahead/datasource/PhabricatorTypeaheadOwnerDatasource.php
+++ b/src/applications/maniphest/typeahead/ManiphestOwnerDatasource.php
@@ -1,6 +1,6 @@
<?php
-final class PhabricatorTypeaheadOwnerDatasource
+final class ManiphestOwnerDatasource
extends PhabricatorTypeaheadCompositeDatasource {
public function getBrowseTitle() {
@@ -8,13 +8,15 @@
}
public function getPlaceholderText() {
- return pht('Type a user name or "none"...');
+ return pht('Type a username or function...');
}
public function getComponentDatasources() {
return array(
+ new PhabricatorViewerDatasource(),
+ new ManiphestNoOwnerDatasource(),
new PhabricatorPeopleDatasource(),
- new PhabricatorTypeaheadNoOwnerDatasource(),
+ new PhabricatorProjectMembersDatasource(),
);
}
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
@@ -126,7 +126,7 @@
id(new AphrontFormTokenizerControl())
->setName('ownerPHIDs')
->setLabel('Owners')
- ->setDatasource(new PhabricatorTypeaheadOwnerDatasource())
+ ->setDatasource(new ManiphestOwnerDatasource())
->setValue($owner_phids))
->appendChild(
id(new AphrontFormCheckboxControl())
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
@@ -247,8 +247,7 @@
// 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
+ // This can happen with composite or generic sources.
if (!$source->getDatasourceApplicationClass()) {
continue;
}
diff --git a/src/applications/typeahead/datasource/PhabricatorTypeaheadNoOwnerDatasource.php b/src/applications/typeahead/datasource/PhabricatorTypeaheadNoOwnerDatasource.php
deleted file mode 100644
--- a/src/applications/typeahead/datasource/PhabricatorTypeaheadNoOwnerDatasource.php
+++ /dev/null
@@ -1,32 +0,0 @@
-<?php
-
-final class PhabricatorTypeaheadNoOwnerDatasource
- extends PhabricatorTypeaheadDatasource {
-
- public function getBrowseTitle() {
- return pht('Browse No Owner');
- }
-
- public function getPlaceholderText() {
- return pht('Type "none"...');
- }
-
- public function getDatasourceApplicationClass() {
- return null;
- }
-
- public function loadResults() {
- $viewer = $this->getViewer();
- $raw_query = $this->getRawQuery();
-
- $results = array();
-
- $results[] = id(new PhabricatorTypeaheadResult())
- ->setName(pht('None'))
- ->setIcon('fa-ban orange')
- ->setPHID(ManiphestTaskOwner::OWNER_UP_FOR_GRABS);
-
- return $results;
- }
-
-}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Oct 22, 11:32 PM (3 w, 6 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6743069
Default Alt Text
D12470.diff (16 KB)
Attached To
Mode
D12470: Collapse "Show unassigned tasks" in Maniphest into a parameterized owners typeahead
Attached
Detach File
Event Timeline
Log In to Comment