diff --git a/CHANGELOG.md b/CHANGELOG.md index 0f2270f10..4513b47e1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ This project follows [Semantic Versioning](http://semver.org) guidelines. * TS3 egg updated to use CLI arguments correctly and have a more minimalistic installation script. * Terminal was not properly displaying longer lines leading to some visual inconsistency. * Assorted translation updates. +* Pagination for server listing now properly respects configuration setting. ### Changed * Removed PhraseApp integration from Panel code as it is no longer used. diff --git a/app/Contracts/Repository/ServerRepositoryInterface.php b/app/Contracts/Repository/ServerRepositoryInterface.php index 6f392d05d..f00d29d8e 100644 --- a/app/Contracts/Repository/ServerRepositoryInterface.php +++ b/app/Contracts/Repository/ServerRepositoryInterface.php @@ -103,10 +103,10 @@ interface ServerRepositoryInterface extends RepositoryInterface, SearchableInter * * @param \Pterodactyl\Models\User $user * @param int $level - * @param bool $paginate + * @param bool|int $paginate * @return \Illuminate\Pagination\LengthAwarePaginator|\Illuminate\Database\Eloquent\Collection */ - public function filterUserAccessServers(User $user, int $level, bool $paginate = true); + public function filterUserAccessServers(User $user, int $level, $paginate = 25); /** * Return a server by UUID. diff --git a/app/Http/Controllers/Api/Client/ClientController.php b/app/Http/Controllers/Api/Client/ClientController.php index d2e1f33a9..2dffba8f0 100644 --- a/app/Http/Controllers/Api/Client/ClientController.php +++ b/app/Http/Controllers/Api/Client/ClientController.php @@ -35,7 +35,7 @@ class ClientController extends ClientApiController */ public function index(GetServersRequest $request): array { - $servers = $this->repository->filterUserAccessServers($request->user(), User::FILTER_LEVEL_SUBUSER); + $servers = $this->repository->filterUserAccessServers($request->user(), User::FILTER_LEVEL_SUBUSER, config('pterodactyl.paginate.frontend.servers')); return $this->fractal->collection($servers) ->transformWith($this->getTransformer(ServerTransformer::class)) diff --git a/app/Http/Controllers/Base/IndexController.php b/app/Http/Controllers/Base/IndexController.php index f5272935f..20ef370eb 100644 --- a/app/Http/Controllers/Base/IndexController.php +++ b/app/Http/Controllers/Base/IndexController.php @@ -56,7 +56,7 @@ class IndexController extends Controller public function getIndex(Request $request) { $servers = $this->repository->setSearchTerm($request->input('query'))->filterUserAccessServers( - $request->user(), User::FILTER_LEVEL_ALL + $request->user(), User::FILTER_LEVEL_ALL, config('pterodactyl.paginate.frontend.servers') ); return view('base.index', ['servers' => $servers]); diff --git a/app/Repositories/Eloquent/ServerRepository.php b/app/Repositories/Eloquent/ServerRepository.php index e900c92dd..3c0248be1 100644 --- a/app/Repositories/Eloquent/ServerRepository.php +++ b/app/Repositories/Eloquent/ServerRepository.php @@ -211,10 +211,10 @@ class ServerRepository extends EloquentRepository implements ServerRepositoryInt * * @param \Pterodactyl\Models\User $user * @param int $level - * @param bool $paginate + * @param bool|int $paginate * @return \Illuminate\Contracts\Pagination\LengthAwarePaginator|\Illuminate\Database\Eloquent\Collection */ - public function filterUserAccessServers(User $user, int $level, bool $paginate = true) + public function filterUserAccessServers(User $user, int $level, $paginate = 25) { $instance = $this->getBuilder()->select($this->getColumns())->with(['user', 'node', 'allocation']); @@ -240,7 +240,7 @@ class ServerRepository extends EloquentRepository implements ServerRepositoryInt $instance->search($this->getSearchTerm()); - return $paginate ? $instance->paginate(25) : $instance->get(); + return $paginate ? $instance->paginate($paginate) : $instance->get(); } /**