Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14077064
D10075.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
6 KB
Referenced Files
None
Subscribers
None
D10075.diff
View Options
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
@@ -50,6 +50,11 @@
const ORDER_MODIFIED = 'order-modified';
const ORDER_TITLE = 'order-title';
+ private $hasAssignee = 'assignee-doesnt-matter';
+ const ASSIGNEE_DOESNT_MATTER = 'assignee-doesnt-matter';
+ const ASSIGNEE_YES = 'assignee-yes';
+ const ASSIGNEE_NO = 'assignee-no';
+
const DEFAULT_PAGE_SIZE = 1000;
public function withAuthors(array $authors) {
@@ -143,6 +148,11 @@
return $this;
}
+ public function setHasAssignee($has_assignee) {
+ $this->hasAssignee = $has_assignee;
+ return $this;
+ }
+
public function setOrderBy($order) {
$this->orderBy = $order;
return $this;
@@ -441,30 +451,44 @@
}
private function buildOwnerWhereClause(AphrontDatabaseConnection $conn) {
- if (!$this->ownerPHIDs) {
- if ($this->includeUnowned === null) {
- return null;
- } else if ($this->includeUnowned) {
+ if ($this->hasAssignee === self::ASSIGNEE_NO) {
+ if (!$this->ownerPHIDs) {
return qsprintf(
$conn,
'ownerPHID IS NULL');
- } else {
+ }
+ else {
+ // If user has specified a user but set "No Asignee" then the
+ // no-asignee statement takes priority, and we return a false clause
+ // causing no results at all times.
+ return qsprintf(
+ $conn,
+ '1=2');
+ }
+ }
+ else if ($this->hasAssignee === self::ASSIGNEE_YES) {
+ if (!$this->ownerPHIDs) {
return qsprintf(
$conn,
'ownerPHID IS NOT NULL');
}
+ else {
+ return qsprintf(
+ $conn,
+ 'ownerPHID IN (%Ls)',
+ $this->ownerPHIDs);
+ }
}
-
- if ($this->includeUnowned) {
- return qsprintf(
- $conn,
- 'ownerPHID IN (%Ls) OR ownerPHID IS NULL',
- $this->ownerPHIDs);
- } else {
- return qsprintf(
- $conn,
- 'ownerPHID IN (%Ls)',
- $this->ownerPHIDs);
+ else if ($this->hasAssignee === self::ASSIGNEE_DOESNT_MATTER) {
+ if (!$this->ownerPHIDs) {
+ return null;
+ }
+ else {
+ return qsprintf(
+ $conn,
+ 'ownerPHID IN (%Ls)',
+ $this->ownerPHIDs);
+ }
}
}
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'));
@@ -68,6 +66,7 @@
$this->readListFromRequest($request, 'priorities'));
$saved->setParameter('group', $request->getStr('group'));
+ $saved->setParameter('has_assignee', $request->getStr('has_assignee'));
$saved->setParameter('order', $request->getStr('order'));
$ids = $request->getStrList('ids');
@@ -131,14 +130,9 @@
$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);
- }
+ $assigned_phids = $saved->getParameter('assignedPHIDs', array());
+ if ($assigned_phids) {
+ $query->withOwners($assigned_phids);
}
$statuses = $saved->getParameter('statuses');
@@ -167,6 +161,14 @@
$query->setGroupBy(head($this->getGroupValues()));
}
+ $has_assignee = $saved->getParameter('has_assignee');
+ $has_assignee = idx($this->getHasAssigneeValues(), $has_assignee);
+ if ($has_assignee) {
+ $query->setHasAssignee($has_assignee);
+ } else {
+ $query->setHasAssignee(head($this->getHasAssigneeValues()));
+ }
+
$ids = $saved->getParameter('ids');
if ($ids) {
$query->withIDs($ids);
@@ -277,7 +279,6 @@
$user_project_handles = array_select_keys($handles, $user_project_phids);
$subscriber_handles = array_select_keys($handles, $subscriber_phids);
- $with_unassigned = $saved->getParameter('withUnassigned');
$with_no_projects = $saved->getParameter('withNoProject');
$statuses = $saved->getParameter('statuses', array());
@@ -314,13 +315,6 @@
->setLabel(pht('Assigned To'))
->setValue($assigned_handles))
->appendChild(
- id(new AphrontFormCheckboxControl())
- ->addCheckbox(
- 'withUnassigned',
- 1,
- pht('Show only unassigned tasks.'),
- $with_unassigned))
- ->appendChild(
id(new AphrontFormTokenizerControl())
->setDatasource(new PhabricatorProjectDatasource())
->setName('allProjects')
@@ -387,6 +381,13 @@
->setValue($saved->getParameter('order'))
->setOptions($this->getOrderOptions()));
}
+ $form
+ ->appendChild(
+ id(new AphrontFormSelectControl())
+ ->setName('has_assignee')
+ ->setLabel(pht('Has Assignee'))
+ ->setValue($saved->getParameter('has_assignee'))
+ ->setOptions($this->getHasAssigneeOptions()));
$form
->appendChild(
@@ -515,6 +516,22 @@
);
}
+ private function getHasAssigneeOptions() {
+ return array(
+ 'doesnt_matter' => pht('Doesn\'t Matter'),
+ 'yes' => pht('Yes'),
+ 'no' => pht('No')
+ );
+ }
+
+ private function getHasAssigneeValues () {
+ return array(
+ 'doesnt_matter' => ManiphestTaskQuery::ASSIGNEE_DOESNT_MATTER,
+ 'yes' => ManiphestTaskQuery::ASSIGNEE_YES,
+ 'no' => ManiphestTaskQuery::ASSIGNEE_NO
+ );
+ }
+
private function getGroupValues() {
return array(
'priority' => ManiphestTaskQuery::GROUP_PRIORITY,
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Nov 22, 9:08 PM (13 h, 59 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6775978
Default Alt Text
D10075.diff (6 KB)
Attached To
Mode
D10075: Allow searching tasks by has-assignee status
Attached
Detach File
Event Timeline
Log In to Comment