mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-27 01:02:42 +01:00
Add date filtering to Maniphest "pro" search
Summary: Adds date created filtering. There's a task for this somewhere that I can't immediately find. Test Plan: Filtered tasks. Reviewers: btrahan Reviewed By: btrahan CC: aran Differential Revision: https://secure.phabricator.com/D6952
This commit is contained in:
parent
bdef58216e
commit
1c43fceffb
2 changed files with 50 additions and 0 deletions
|
@ -20,6 +20,8 @@ final class ManiphestTaskQuery
|
|||
private $anyProjectPHIDs = array();
|
||||
private $anyUserProjectPHIDs = array();
|
||||
private $includeNoProject = null;
|
||||
private $dateCreatedAfter;
|
||||
private $dateCreatedBefore;
|
||||
|
||||
private $fullTextSearch = '';
|
||||
|
||||
|
@ -183,6 +185,16 @@ final class ManiphestTaskQuery
|
|||
return $this;
|
||||
}
|
||||
|
||||
public function withDateCreatedBefore($date_created_before) {
|
||||
$this->dateCreatedBefore = $date_created_before;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function withDateCreatedAfter($date_created_after) {
|
||||
$this->dateCreatedAfter = $date_created_after;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function loadPage() {
|
||||
|
||||
// TODO: (T603) It is possible for a user to find the PHID of a project
|
||||
|
@ -220,6 +232,22 @@ final class ManiphestTaskQuery
|
|||
$where[] = $this->buildXProjectWhereClause($conn);
|
||||
$where[] = $this->buildFullTextWhereClause($conn);
|
||||
|
||||
// TODO: Add a key for this the next time we hit this table.
|
||||
|
||||
if ($this->dateCreatedAfter) {
|
||||
$where[] = qsprintf(
|
||||
$conn,
|
||||
'dateCreated >= %d',
|
||||
$this->dateCreatedAfter);
|
||||
}
|
||||
|
||||
if ($this->dateCreatedBefore) {
|
||||
$where[] = qsprintf(
|
||||
$conn,
|
||||
'dateCreated <= %d',
|
||||
$this->dateCreatedBefore);
|
||||
}
|
||||
|
||||
$where = $this->formatWhereClause($where);
|
||||
|
||||
$join = array();
|
||||
|
|
|
@ -53,6 +53,9 @@ final class ManiphestTaskSearchEngine
|
|||
'userProjectPHIDs',
|
||||
$this->readUsersFromRequest($request, 'userProjects'));
|
||||
|
||||
$saved->setParameter('createdStart', $request->getStr('createdStart'));
|
||||
$saved->setParameter('createdEnd', $request->getStr('createdEnd'));
|
||||
|
||||
return $saved;
|
||||
}
|
||||
|
||||
|
@ -127,6 +130,17 @@ final class ManiphestTaskSearchEngine
|
|||
$query->withAnyUserProjects($user_project_phids);
|
||||
}
|
||||
|
||||
$start = $this->parseDateTime($saved->getParameter('createdStart'));
|
||||
$end = $this->parseDateTime($saved->getParameter('createdEnd'));
|
||||
|
||||
if ($start) {
|
||||
$query->withDateCreatedAfter($start);
|
||||
}
|
||||
|
||||
if ($end) {
|
||||
$query->withDateCreatedBefore($end);
|
||||
}
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
|
@ -273,6 +287,14 @@ final class ManiphestTaskSearchEngine
|
|||
->setName('ids')
|
||||
->setLabel(pht('Task IDs'))
|
||||
->setValue(implode(', ', $ids)));
|
||||
|
||||
$this->buildDateRange(
|
||||
$form,
|
||||
$saved,
|
||||
'createdStart',
|
||||
pht('Created After'),
|
||||
'createdEnd',
|
||||
pht('Created Before'));
|
||||
}
|
||||
|
||||
protected function getURI($path) {
|
||||
|
|
Loading…
Reference in a new issue