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