diff --git a/src/applications/diffusion/controller/history/DiffusionHistoryController.php b/src/applications/diffusion/controller/history/DiffusionHistoryController.php index f64e3e97e3..67f031735f 100644 --- a/src/applications/diffusion/controller/history/DiffusionHistoryController.php +++ b/src/applications/diffusion/controller/history/DiffusionHistoryController.php @@ -20,12 +20,28 @@ class DiffusionHistoryController extends DiffusionController { public function processRequest() { $drequest = $this->diffusionRequest; + $request = $this->getRequest(); + + $page_size = $request->getInt('pagesize', 100); + $offset = $request->getInt('page', 0); $history_query = DiffusionHistoryQuery::newFromDiffusionRequest( $drequest); - + $history_query->setOffset($offset); + $history_query->setLimit($page_size + 1); $history = $history_query->loadHistory(); + $pager = new AphrontPagerView(); + $pager->setPageSize($page_size); + $pager->setOffset($offset); + if (count($history) == $page_size + 1) { + array_pop($history); + $pager->setHasMorePages(true); + } else { + $pager->setHasMorePages(false); + } + $pager->setURI($request->getRequestURI(), 'page'); + $content = array(); $content[] = $this->buildCrumbs( @@ -41,6 +57,7 @@ class DiffusionHistoryController extends DiffusionController { $history_panel = new AphrontPanelView(); $history_panel->appendChild($history_table); + $history_panel->appendChild($pager); $content[] = $history_panel; diff --git a/src/applications/diffusion/controller/history/__init__.php b/src/applications/diffusion/controller/history/__init__.php index 21bf7ac13f..217148e472 100644 --- a/src/applications/diffusion/controller/history/__init__.php +++ b/src/applications/diffusion/controller/history/__init__.php @@ -9,6 +9,7 @@ phutil_require_module('phabricator', 'applications/diffusion/controller/base'); phutil_require_module('phabricator', 'applications/diffusion/query/history/base'); phutil_require_module('phabricator', 'applications/diffusion/view/historytable'); +phutil_require_module('phabricator', 'view/control/pager'); phutil_require_module('phabricator', 'view/layout/panel'); diff --git a/src/applications/diffusion/query/history/svn/DiffusionSvnHistoryQuery.php b/src/applications/diffusion/query/history/svn/DiffusionSvnHistoryQuery.php index ec6734325a..f2a4f6b070 100644 --- a/src/applications/diffusion/query/history/svn/DiffusionSvnHistoryQuery.php +++ b/src/applications/diffusion/query/history/svn/DiffusionSvnHistoryQuery.php @@ -43,11 +43,12 @@ final class DiffusionSvnHistoryQuery extends DiffusionHistoryQuery { 'SELECT * FROM %T WHERE repositoryID = %d AND pathID = %d AND commitSequence <= %d ORDER BY commitSequence DESC - LIMIT %d', + LIMIT %d, %d', PhabricatorRepository::TABLE_PATHCHANGE, $repository->getID(), $path_id, $commit ? $commit : 0x7FFFFFFF, + $this->getOffset(), $this->getLimit()); $commits = array(); diff --git a/src/applications/people/storage/user/PhabricatorUser.php b/src/applications/people/storage/user/PhabricatorUser.php index ed32f92ef8..efc7c9ebb9 100644 --- a/src/applications/people/storage/user/PhabricatorUser.php +++ b/src/applications/people/storage/user/PhabricatorUser.php @@ -34,7 +34,7 @@ class PhabricatorUser extends PhabricatorUserDAO { protected $conduitCertificate; - protected $preferences = null; + private $preferences = null; public function getProfileImagePHID() { return nonempty(