From 9116547e98a52c21e2f30adae220c43eafc40d99 Mon Sep 17 00:00:00 2001 From: Dane Everitt Date: Tue, 23 May 2017 23:00:31 -0500 Subject: [PATCH] allow emptying server description, closes #442 --- CHANGELOG.md | 1 + app/Http/Controllers/Admin/ServersController.php | 9 ++++++--- app/Repositories/ServerRepository.php | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9fbfd37a3..47ee976ea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ This project follows [Semantic Versioning](http://semver.org) guidelines. ### Changed * Renamed session cookies from `laravel_session` to `pterodactyl_session`. * Sessions are now encrypted before being stored as an additional layer of security. +* It is now possible to clear out a server description and have it be blank, rather than throwing an error about the field being required. ## v0.6.0 (Courageous Carniadactylus) ### Fixed diff --git a/app/Http/Controllers/Admin/ServersController.php b/app/Http/Controllers/Admin/ServersController.php index 281152273..76715c84c 100644 --- a/app/Http/Controllers/Admin/ServersController.php +++ b/app/Http/Controllers/Admin/ServersController.php @@ -273,9 +273,12 @@ class ServersController extends Controller { $repo = new ServerRepository; try { - $repo->updateDetails($id, $request->intersect([ - 'owner_id', 'name', 'description', 'reset_token', - ])); + $repo->updateDetails($id, array_merge( + $request->only('description'), + $request->intersect([ + 'owner_id', 'name', 'reset_token', + ]) + )); Alert::success('Server details were successfully updated.')->flash(); } catch (DisplayValidationException $ex) { diff --git a/app/Repositories/ServerRepository.php b/app/Repositories/ServerRepository.php index e75b31bac..fa0a678fa 100644 --- a/app/Repositories/ServerRepository.php +++ b/app/Repositories/ServerRepository.php @@ -370,7 +370,7 @@ class ServerRepository $validator = Validator::make($data, [ 'owner_id' => 'sometimes|required|integer|exists:users,id', 'name' => 'sometimes|required|regex:([\w .-]{1,200})', - 'description' => 'sometimes|required|string', + 'description' => 'sometimes|nullable|string', 'reset_token' => 'sometimes|required|accepted', ]);