Differential D21619 Diff 51465 src/applications/differential/controller/DifferentialRevisionViewController.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/differential/controller/DifferentialRevisionViewController.php
Show First 20 Lines • Show All 980 Lines • ▼ Show 20 Lines | final class DifferentialRevisionViewController | ||||
} | } | ||||
private function loadOtherRevisions( | private function loadOtherRevisions( | ||||
array $changesets, | array $changesets, | ||||
DifferentialDiff $target, | DifferentialDiff $target, | ||||
PhabricatorRepository $repository) { | PhabricatorRepository $repository) { | ||||
assert_instances_of($changesets, 'DifferentialChangeset'); | assert_instances_of($changesets, 'DifferentialChangeset'); | ||||
$viewer = $this->getViewer(); | |||||
$paths = array(); | $paths = array(); | ||||
foreach ($changesets as $changeset) { | foreach ($changesets as $changeset) { | ||||
$paths[] = $changeset->getAbsoluteRepositoryPath( | $paths[] = $changeset->getAbsoluteRepositoryPath( | ||||
$repository, | $repository, | ||||
$target); | $target); | ||||
} | } | ||||
if (!$paths) { | if (!$paths) { | ||||
return array(); | return array(); | ||||
} | } | ||||
$path_map = id(new DiffusionPathIDQuery($paths))->loadPathIDs(); | |||||
if (!$path_map) { | |||||
return array(); | |||||
} | |||||
$recent = (PhabricatorTime::getNow() - phutil_units('30 days in seconds')); | $recent = (PhabricatorTime::getNow() - phutil_units('30 days in seconds')); | ||||
$query = id(new DifferentialRevisionQuery()) | $query = id(new DifferentialRevisionQuery()) | ||||
->setViewer($this->getRequest()->getUser()) | ->setViewer($viewer) | ||||
->withIsOpen(true) | ->withIsOpen(true) | ||||
->withUpdatedEpochBetween($recent, null) | ->withUpdatedEpochBetween($recent, null) | ||||
->setOrder(DifferentialRevisionQuery::ORDER_MODIFIED) | ->setOrder(DifferentialRevisionQuery::ORDER_MODIFIED) | ||||
->setLimit(10) | ->setLimit(10) | ||||
->needFlags(true) | ->needFlags(true) | ||||
->needDrafts(true) | ->needDrafts(true) | ||||
->needReviewers(true); | ->needReviewers(true) | ||||
->withRepositoryPHIDs( | |||||
foreach ($path_map as $path => $path_id) { | array( | ||||
$query->withPath($repository->getID(), $path_id); | $repository->getPHID(), | ||||
} | )) | ||||
->withPaths($paths); | |||||
$results = $query->execute(); | $results = $query->execute(); | ||||
// Strip out *this* revision. | // Strip out *this* revision. | ||||
foreach ($results as $key => $result) { | foreach ($results as $key => $result) { | ||||
if ($result->getID() == $this->revisionID) { | if ($result->getID() == $this->revisionID) { | ||||
unset($results[$key]); | unset($results[$key]); | ||||
break; | |||||
} | } | ||||
} | } | ||||
return $results; | return $results; | ||||
} | } | ||||
private function renderOtherRevisions(array $revisions) { | private function renderOtherRevisions(array $revisions) { | ||||
assert_instances_of($revisions, 'DifferentialRevision'); | assert_instances_of($revisions, 'DifferentialRevision'); | ||||
▲ Show 20 Lines • Show All 423 Lines • Show Last 20 Lines |