Let feed panels render something meaningful-ish
Summary:
Ref T4986. We need to introduce alternate views to make this more pleasant, but let rendering move to engines so it can be shared between panels and controllers.
I also moved some of the pagination logic in to avoid duplicating that.
So far, only Feed works. I'm going to do these gradually since we have ~40-50 of them.
Test Plan:
- Used global search to check for collateral damage.
- Used not-global search too.
- Used normal feed.
{F151541}
Reviewers: btrahan
Reviewed By: btrahan
Subscribers: chad, epriestley
Maniphest Tasks: T4986
Differential Revision: https://secure.phabricator.com/D9008
This commit is contained in:
@@ -7,16 +7,6 @@ final class PhabricatorApplicationSearchController
|
||||
private $navigation;
|
||||
private $queryKey;
|
||||
private $preface;
|
||||
private $useOffsetPaging;
|
||||
|
||||
public function setUseOffsetPaging($use_offset_paging) {
|
||||
$this->useOffsetPaging = $use_offset_paging;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getUseOffsetPaging() {
|
||||
return $this->useOffsetPaging;
|
||||
}
|
||||
|
||||
public function setPreface($preface) {
|
||||
$this->preface = $preface;
|
||||
@@ -78,11 +68,6 @@ final class PhabricatorApplicationSearchController
|
||||
$engine->setViewer($this->getRequest()->getUser());
|
||||
|
||||
$parent = $this->getDelegatingController();
|
||||
$interface = 'PhabricatorApplicationSearchResultsControllerInterface';
|
||||
if (!$parent instanceof $interface) {
|
||||
throw new Exception(
|
||||
"Delegating controller must implement '{$interface}'.");
|
||||
}
|
||||
}
|
||||
|
||||
public function processRequest() {
|
||||
@@ -223,34 +208,23 @@ final class PhabricatorApplicationSearchController
|
||||
|
||||
$query = $engine->buildQueryFromSavedQuery($saved_query);
|
||||
|
||||
$use_offset_paging = $this->getUseOffsetPaging();
|
||||
if ($use_offset_paging) {
|
||||
$pager = new AphrontPagerView();
|
||||
} else {
|
||||
$pager = new AphrontCursorPagerView();
|
||||
}
|
||||
$pager = $engine->newPagerForSavedQuery($saved_query);
|
||||
$pager->readFromRequest($request);
|
||||
$page_size = $engine->getPageSize($saved_query);
|
||||
if (is_finite($page_size)) {
|
||||
$pager->setPageSize($page_size);
|
||||
|
||||
$objects = $engine->executeQuery($query, $pager);
|
||||
|
||||
// TODO: To support Dashboard panels, rendering is moving into
|
||||
// SearchEngines. Move it all the way in and then get rid of this.
|
||||
|
||||
$interface = 'PhabricatorApplicationSearchResultsControllerInterface';
|
||||
if ($parent instanceof $interface) {
|
||||
$list = $parent->renderResultsList($objects, $saved_query);
|
||||
} else {
|
||||
// Consider an INF pagesize to mean a large finite pagesize.
|
||||
|
||||
// TODO: It would be nice to handle this more gracefully, but math
|
||||
// with INF seems to vary across PHP versions, systems, and runtimes.
|
||||
$pager->setPageSize(0xFFFF);
|
||||
$list = $engine->renderResults(
|
||||
$objects,
|
||||
$saved_query);
|
||||
}
|
||||
|
||||
$query->setViewer($request->getUser());
|
||||
|
||||
if ($use_offset_paging) {
|
||||
$objects = $query->executeWithOffsetPager($pager);
|
||||
} else {
|
||||
$objects = $query->executeWithCursorPager($pager);
|
||||
}
|
||||
|
||||
$list = $parent->renderResultsList($objects, $saved_query);
|
||||
|
||||
$nav->appendChild($list);
|
||||
|
||||
// TODO: This is a bit hacky.
|
||||
|
||||
Reference in New Issue
Block a user