1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-22 14:52:41 +01:00

Restrict Differential buckets to just ApplicationSearch views

Summary: Ref T9363, If we're in a dashboard panel, only show buckets with data, or a fallback if nothing exists.

Test Plan: Test 'active revisions' panel in a dashboard and in Differential.

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin

Maniphest Tasks: T9363

Differential Revision: https://secure.phabricator.com/D17544
This commit is contained in:
Chad Little 2017-03-23 12:04:07 -07:00
parent 9099485a71
commit ffab52f17e

View file

@ -162,10 +162,13 @@ final class DifferentialRevisionSearchEngine
$groups = $bucket->newResultGroups($query, $revisions);
foreach ($groups as $group) {
$views[] = id(clone $template)
->setHeader($group->getName())
->setNoDataString($group->getNoDataString())
->setRevisions($group->getObjects());
// Don't show groups in Dashboard Panels
if ($group->getObjects() || !$this->isPanelContext()) {
$views[] = id(clone $template)
->setHeader($group->getName())
->setNoDataString($group->getNoDataString())
->setRevisions($group->getObjects());
}
}
} catch (Exception $ex) {
$this->addError($ex->getMessage());
@ -176,6 +179,12 @@ final class DifferentialRevisionSearchEngine
->setHandles(array());
}
if (!$views) {
$views[] = id(new DifferentialRevisionListView())
->setUser($viewer)
->setNoDataString(pht('No revisions found.'));
}
$phids = array_mergev(mpull($views, 'getRequiredHandlePHIDs'));
if ($phids) {
$handles = id(new PhabricatorHandleQuery())