From f4e6ff1c07d952931f42bf3bb5abcb94b6324a83 Mon Sep 17 00:00:00 2001 From: Pedro Cunha Date: Tue, 3 Dec 2024 15:27:18 +0000 Subject: [PATCH] fix: properly set modpacks as hidden on creation Fixes #734 --- app/Http/Controllers/ModpackController.php | 3 ++- resources/views/modpack/create.blade.php | 11 +++++++++++ resources/views/modpack/edit.blade.php | 6 +++--- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/app/Http/Controllers/ModpackController.php b/app/Http/Controllers/ModpackController.php index cf6260ac..5d746a8b 100644 --- a/app/Http/Controllers/ModpackController.php +++ b/app/Http/Controllers/ModpackController.php @@ -250,6 +250,7 @@ public function postCreate(): RedirectResponse $rules = [ 'name' => 'required|unique:modpacks', 'slug' => 'required|unique:modpacks', + 'hidden' => 'sometimes|required', ]; $messages = [ @@ -266,7 +267,7 @@ public function postCreate(): RedirectResponse $modpack = new Modpack; $modpack->name = Request::input('name'); $modpack->slug = Str::slug(Request::input('slug')); - $modpack->hidden = Request::input('hidden') ? false : true; + $modpack->hidden = request()->boolean('hidden'); $modpack->icon_md5 = null; $modpack->icon_url = URL::asset('/resources/default/icon.png'); $modpack->logo_md5 = null; diff --git a/resources/views/modpack/create.blade.php b/resources/views/modpack/create.blade.php index 8fef35fa..5014fb54 100644 --- a/resources/views/modpack/create.blade.php +++ b/resources/views/modpack/create.blade.php @@ -30,6 +30,17 @@ +
+
+ +

Hidden modpacks will not show up in the API response for the + modpack list. However, anyone with the modpack's slug can access all of its + information.

+
+

Creating a modpack is simple. Fill in the information here.

diff --git a/resources/views/modpack/edit.blade.php b/resources/views/modpack/edit.blade.php index d3a7dd33..eca4640e 100644 --- a/resources/views/modpack/edit.blade.php +++ b/resources/views/modpack/edit.blade.php @@ -41,9 +41,9 @@ hidden ? ' checked' : '') }}> - Hidden modpacks will not show up in the API response for the - modpack list regardless of whether or not a client has access to the modpack. - +

Hidden modpacks will not show up in the API response for the + modpack list. However, anyone with the modpack's slug can access all of its + information.