1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-01-10 14:51:06 +01:00

Make differential.querydiffs more liberal about arguments

Summary:
Fixes T12092. D17164 made `DiffQuery` more strict about arguments using modern conventions, but `differential.querydiffs` uses bizarre ancient conventions.

Give it more modern conventions instead.

Test Plan: Made a `querydiffs` call with only revision IDs.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T12092

Differential Revision: https://secure.phabricator.com/D17172
This commit is contained in:
epriestley 2017-01-10 13:43:26 -08:00
parent 63af2275ca
commit 52d563f8b8

View file

@ -26,16 +26,27 @@ final class DifferentialQueryDiffsConduitAPIMethod
$ids = $request->getValue('ids', array());
$revision_ids = $request->getValue('revisionIDs', array());
$diffs = array();
if ($ids || $revision_ids) {
$diffs = id(new DifferentialDiffQuery())
->setViewer($request->getUser())
->withIDs($ids)
->withRevisionIDs($revision_ids)
->needChangesets(true)
->execute();
if (!$ids && !$revision_ids) {
// This method just returns nothing if you pass no constraints because
// pagination hadn't been invented yet in 2008 when this method was
// written.
return array();
}
$query = id(new DifferentialDiffQuery())
->setViewer($request->getUser())
->needChangesets(true);
if ($ids) {
$query->withIDs($ids);
}
if ($revision_ids) {
$query->withRevisionIDs($revision_ids);
}
$diffs = $query->execute();
return mpull($diffs, 'getDiffDict', 'getID');
}