mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-15 11:22:40 +01:00
3910d0d5e1
Summary: Ref T2222. This has some minor functionality regressions: - The plain diff page no longer shows unit/test status. I want to give diffs separate custom fields for this. - It was technically possible to shove more data on the list view, although this doensn't affect the default config. Test Plan: Looked at list view, diff detail view. Grepped for changes. Reviewers: btrahan Reviewed By: btrahan CC: aran Maniphest Tasks: T2222 Differential Revision: https://secure.phabricator.com/D8470
86 lines
2.5 KiB
PHP
86 lines
2.5 KiB
PHP
<?php
|
|
|
|
final class DifferentialRevisionListController extends DifferentialController
|
|
implements PhabricatorApplicationSearchResultsControllerInterface {
|
|
|
|
private $queryKey;
|
|
|
|
public function shouldAllowPublic() {
|
|
return true;
|
|
}
|
|
|
|
public function willProcessRequest(array $data) {
|
|
$this->queryKey = idx($data, 'queryKey');
|
|
}
|
|
|
|
public function processRequest() {
|
|
$request = $this->getRequest();
|
|
$controller = id(new PhabricatorApplicationSearchController($request))
|
|
->setQueryKey($this->queryKey)
|
|
->setSearchEngine(new DifferentialRevisionSearchEngine())
|
|
->setNavigation($this->buildSideNavView());
|
|
|
|
return $this->delegateToController($controller);
|
|
}
|
|
|
|
public function renderResultsList(
|
|
array $revisions,
|
|
PhabricatorSavedQuery $query) {
|
|
assert_instances_of($revisions, 'DifferentialRevision');
|
|
|
|
$user = $this->getRequest()->getUser();
|
|
$template = id(new DifferentialRevisionListView())
|
|
->setUser($user);
|
|
|
|
$views = array();
|
|
if ($query->getQueryKey() == 'active') {
|
|
$split = DifferentialRevisionQuery::splitResponsible(
|
|
$revisions,
|
|
$query->getParameter('responsiblePHIDs'));
|
|
list($blocking, $active, $waiting) = $split;
|
|
|
|
$views[] = id(clone $template)
|
|
->setHeader(pht('Blocking Others'))
|
|
->setNoDataString(
|
|
pht('No revisions are blocked on your action.'))
|
|
->setHighlightAge(true)
|
|
->setRevisions($blocking)
|
|
->setHandles(array());
|
|
|
|
$views[] = id(clone $template)
|
|
->setHeader(pht('Action Required'))
|
|
->setNoDataString(
|
|
pht('No revisions require your action.'))
|
|
->setHighlightAge(true)
|
|
->setRevisions($active)
|
|
->setHandles(array());
|
|
|
|
$views[] = id(clone $template)
|
|
->setHeader(pht('Waiting on Others'))
|
|
->setNoDataString(
|
|
pht('You have no revisions waiting on others.'))
|
|
->setRevisions($waiting)
|
|
->setHandles(array());
|
|
} else {
|
|
$views[] = id(clone $template)
|
|
->setRevisions($revisions)
|
|
->setHandles(array());
|
|
}
|
|
|
|
$phids = array_mergev(mpull($views, 'getRequiredHandlePHIDs'));
|
|
$handles = $this->loadViewerHandles($phids);
|
|
|
|
foreach ($views as $view) {
|
|
$view->setHandles($handles);
|
|
}
|
|
|
|
if (count($views) == 1) {
|
|
// Reduce this to a PHUIObjectItemListView so we can get the free
|
|
// support from ApplicationSearch.
|
|
return head($views)->render();
|
|
} else {
|
|
return $views;
|
|
}
|
|
}
|
|
|
|
}
|