Allow revisions to be filtered by created date
Summary: Ref T13202. See PHI906. This is a reasonable capability which we support in some other applications already. (The only real reason not to support this is that it creates some clutter in the UI, but I think we're generally in better shape now than we were in the past, and we could make this UI collapse/fold at some point.) Test Plan: Ran queries with a minimum date, a maximum date, both, and neither. Saw appropriate results in all cases. Reviewers: amckinley Reviewed By: amckinley Maniphest Tasks: T13202 Differential Revision: https://secure.phabricator.com/D19732
This commit is contained in:
@@ -25,6 +25,8 @@ final class DifferentialRevisionQuery
|
|||||||
private $updatedEpochMax;
|
private $updatedEpochMax;
|
||||||
private $statuses;
|
private $statuses;
|
||||||
private $isOpen;
|
private $isOpen;
|
||||||
|
private $createdEpochMin;
|
||||||
|
private $createdEpochMax;
|
||||||
|
|
||||||
const ORDER_MODIFIED = 'order-modified';
|
const ORDER_MODIFIED = 'order-modified';
|
||||||
const ORDER_CREATED = 'order-created';
|
const ORDER_CREATED = 'order-created';
|
||||||
@@ -206,6 +208,12 @@ final class DifferentialRevisionQuery
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function withCreatedEpochBetween($min, $max) {
|
||||||
|
$this->createdEpochMin = $min;
|
||||||
|
$this->createdEpochMax = $max;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set whether or not the query should load the active diff for each
|
* Set whether or not the query should load the active diff for each
|
||||||
@@ -687,6 +695,20 @@ final class DifferentialRevisionQuery
|
|||||||
$this->updatedEpochMax);
|
$this->updatedEpochMax);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($this->createdEpochMin !== null) {
|
||||||
|
$where[] = qsprintf(
|
||||||
|
$conn_r,
|
||||||
|
'r.dateCreated >= %d',
|
||||||
|
$this->createdEpochMin);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->createdEpochMax !== null) {
|
||||||
|
$where[] = qsprintf(
|
||||||
|
$conn_r,
|
||||||
|
'r.dateCreated <= %d',
|
||||||
|
$this->createdEpochMax);
|
||||||
|
}
|
||||||
|
|
||||||
if ($this->statuses !== null) {
|
if ($this->statuses !== null) {
|
||||||
$where[] = qsprintf(
|
$where[] = qsprintf(
|
||||||
$conn_r,
|
$conn_r,
|
||||||
|
|||||||
@@ -45,6 +45,12 @@ final class DifferentialRevisionSearchEngine
|
|||||||
$query->withStatuses($map['statuses']);
|
$query->withStatuses($map['statuses']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($map['createdStart'] || $map['createdEnd']) {
|
||||||
|
$query->withCreatedEpochBetween(
|
||||||
|
$map['createdStart'],
|
||||||
|
$map['createdEnd']);
|
||||||
|
}
|
||||||
|
|
||||||
return $query;
|
return $query;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -84,6 +90,16 @@ final class DifferentialRevisionSearchEngine
|
|||||||
->setDatasource(new DifferentialRevisionStatusFunctionDatasource())
|
->setDatasource(new DifferentialRevisionStatusFunctionDatasource())
|
||||||
->setDescription(
|
->setDescription(
|
||||||
pht('Find revisions with particular statuses.')),
|
pht('Find revisions with particular statuses.')),
|
||||||
|
id(new PhabricatorSearchDateField())
|
||||||
|
->setLabel(pht('Created After'))
|
||||||
|
->setKey('createdStart')
|
||||||
|
->setDescription(
|
||||||
|
pht('Find revisions created at or after a particular time.')),
|
||||||
|
id(new PhabricatorSearchDateField())
|
||||||
|
->setLabel(pht('Created Before'))
|
||||||
|
->setKey('createdEnd')
|
||||||
|
->setDescription(
|
||||||
|
pht('Find revisions created at or before a particular time.')),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user