Skip to content

Commit

Permalink
fix: properly set modpacks as hidden on creation
Browse files Browse the repository at this point in the history
Fixes #734
  • Loading branch information
Pyker committed Dec 3, 2024
1 parent e178360 commit f4e6ff1
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
3 changes: 2 additions & 1 deletion app/Http/Controllers/ModpackController.php
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ public function postCreate(): RedirectResponse
$rules = [
'name' => 'required|unique:modpacks',
'slug' => 'required|unique:modpacks',
'hidden' => 'sometimes|required',
];

$messages = [
Expand All @@ -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;
Expand Down
11 changes: 11 additions & 0 deletions resources/views/modpack/create.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,17 @@
<label for="slug">Modpack Slug</label>
<input type="text" class="form-control" name="slug" id="slug">
</div>
<div class="form-group">
<div class="checkbox">
<label>
<input type="checkbox" name="hidden" id="hidden" checked>
Hide modpack
</label>
<p class="help-block">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.</p>
</div>
</div>
</div>
<div class="col-md-6">
<p>Creating a modpack is simple. Fill in the information here.</p>
Expand Down
6 changes: 3 additions & 3 deletions resources/views/modpack/edit.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@
<input type="checkbox"
name="hidden"
id="hidden"{{ $checked = ($modpack->hidden ? ' checked' : '') }}>
<span class="help-block">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.
</span>
<p class="help-block">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.</p>
</div>
</div>
<div class="control-group">
Expand Down

0 comments on commit f4e6ff1

Please sign in to comment.