mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-22 14:52:41 +01:00
Replace Differential hard-coded status "<select />" with tokenizer
Summary: Ref T2543. This updates the UI control in the web UI. Also: - This implicitly makes this queryable with the API (`differential.revision.search`); it previously was not. - This does NOT migrate existing saved queries. I'll do those in the next change, and hold this until it happens. - This will break some existing `/differential/?status=XYZ` links. For example, `status=open` now needs to be `status=open()`. I couldn't find any of these in the upstream, and I suspect these are rare in the wild (users would normally link directly to saved queries, not use URI query construction). Test Plan: {F5093611} Reviewers: chad Reviewed By: chad Maniphest Tasks: T2543 Differential Revision: https://secure.phabricator.com/D18393
This commit is contained in:
parent
8160baec2a
commit
53516093ae
3 changed files with 26 additions and 8 deletions
|
@ -28,8 +28,12 @@ final class DifferentialLegacyQuery
|
|||
$status));
|
||||
}
|
||||
|
||||
return self::getLegacyValues($map[$status]);
|
||||
}
|
||||
|
||||
public static function getLegacyValues(array $modern_values) {
|
||||
$values = array();
|
||||
foreach ($map[$status] as $status_constant) {
|
||||
foreach ($modern_values as $status_constant) {
|
||||
$status_object = DifferentialRevisionStatus::newForStatus(
|
||||
$status_constant);
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@ final class DifferentialRevisionQuery
|
|||
private $repositoryPHIDs;
|
||||
private $updatedEpochMin;
|
||||
private $updatedEpochMax;
|
||||
private $statuses;
|
||||
|
||||
const ORDER_MODIFIED = 'order-modified';
|
||||
const ORDER_CREATED = 'order-created';
|
||||
|
@ -146,6 +147,11 @@ final class DifferentialRevisionQuery
|
|||
return $this;
|
||||
}
|
||||
|
||||
public function withStatuses(array $statuses) {
|
||||
$this->statuses = $statuses;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Filter results to revisions on given branches.
|
||||
|
@ -705,6 +711,13 @@ final class DifferentialRevisionQuery
|
|||
$statuses);
|
||||
}
|
||||
|
||||
if ($this->statuses !== null) {
|
||||
$where[] = qsprintf(
|
||||
$conn_r,
|
||||
'r.status in (%Ls)',
|
||||
DifferentialLegacyQuery::getLegacyValues($this->statuses));
|
||||
}
|
||||
|
||||
$where[] = $this->buildWhereClauseParts($conn_r);
|
||||
return $this->formatWhereClause($where);
|
||||
}
|
||||
|
|
|
@ -41,8 +41,8 @@ final class DifferentialRevisionSearchEngine
|
|||
$query->withRepositoryPHIDs($map['repositoryPHIDs']);
|
||||
}
|
||||
|
||||
if ($map['status']) {
|
||||
$query->withStatus($map['status']);
|
||||
if ($map['statuses']) {
|
||||
$query->withStatuses($map['statuses']);
|
||||
}
|
||||
|
||||
return $query;
|
||||
|
@ -77,10 +77,11 @@ final class DifferentialRevisionSearchEngine
|
|||
->setDatasource(new DiffusionRepositoryFunctionDatasource())
|
||||
->setDescription(
|
||||
pht('Find revisions from specific repositories.')),
|
||||
id(new PhabricatorSearchSelectField())
|
||||
->setLabel(pht('Status'))
|
||||
->setKey('status')
|
||||
->setOptions($this->getStatusOptions())
|
||||
id(new PhabricatorSearchDatasourceField())
|
||||
->setLabel(pht('Statuses'))
|
||||
->setKey('statuses')
|
||||
->setAliases(array('status'))
|
||||
->setDatasource(new DifferentialRevisionStatusFunctionDatasource())
|
||||
->setDescription(
|
||||
pht('Find revisions with particular statuses.')),
|
||||
);
|
||||
|
@ -115,7 +116,7 @@ final class DifferentialRevisionSearchEngine
|
|||
|
||||
return $query
|
||||
->setParameter('responsiblePHIDs', array($viewer->getPHID()))
|
||||
->setParameter('status', DifferentialLegacyQuery::STATUS_OPEN)
|
||||
->setParameter('statuses', array('open()'))
|
||||
->setParameter('bucket', $bucket_key);
|
||||
case 'authored':
|
||||
return $query
|
||||
|
|
Loading…
Reference in a new issue