From e45ccdd89249eaff864efac2797cf514242e7b68 Mon Sep 17 00:00:00 2001 From: epriestley Date: Tue, 2 Apr 2019 05:40:28 -0700 Subject: [PATCH] Fix rendering of offset-paged query panels including "Notifications" Summary: See . A small number of queries (including "Notifications" and (global) "Search") use offset-based pagers which have a slightly different API `PHUIPagerView` instead of `AphrontCursorPagerView`. This leads to a fatal in the new code for the "View All Results" buttons. To fix this, just do an `instanceof` test. Some day we can unify the pagers. Test Plan: Added a notifications panel, rendered it, saw it work instead of fataling on "getHasMoreResults()". Also rendered some normal panels. Reviewers: amckinley Reviewed By: amckinley Differential Revision: https://secure.phabricator.com/D20366 --- .../paneltype/PhabricatorDashboardQueryPanelType.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/applications/dashboard/paneltype/PhabricatorDashboardQueryPanelType.php b/src/applications/dashboard/paneltype/PhabricatorDashboardQueryPanelType.php index a71263b27e..90fe93e2b4 100644 --- a/src/applications/dashboard/paneltype/PhabricatorDashboardQueryPanelType.php +++ b/src/applications/dashboard/paneltype/PhabricatorDashboardQueryPanelType.php @@ -136,7 +136,16 @@ final class PhabricatorDashboardQueryPanelType $results_view->setContent($content); } - if ($pager->getHasMoreResults()) { + // TODO: A small number of queries, including "Notifications" and "Search", + // use an offset pager which has a slightly different API. Some day, we + // should unify these. + if ($pager instanceof PHUIPagerView) { + $has_more = $pager->getHasMorePages(); + } else { + $has_more = $pager->getHasMoreResults(); + } + + if ($has_more) { $item_list = $results_view->getObjectList(); $more_href = $engine->getQueryResultsPageURI($key);