Skip to content

Commit a710bdf

Browse files
committed
Make a todo a todid, closes pterodactyl#774
1 parent 9ee503b commit a710bdf

File tree

4 files changed

+8
-4
lines changed

4 files changed

+8
-4
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ This project follows [Semantic Versioning](http://semver.org) guidelines.
88
* `[beta.2]` — Fixes a bug that would cause an endless exception message stream in the console when attemping to setup environment settings in certain instances.
99
* `[beta.2]` — Fixes a bug causing the dropdown menu for a server's egg to display the wrong selected value.
1010
* `[beta.2]` — Fixes a bug that would throw a red page of death when submitting an invalid egg variable value for a server in the Admin CP.
11+
* `[beta.2]` — Someone found a `@todo` that I never `@todid` and thus database hosts could not be created without being linked to a node. This is fixed...
1112

1213
## v0.7.0-beta.2 (Derelict Dermodactylus)
1314
### Fixed

app/Http/Requests/Admin/DatabaseHostFormRequest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ class DatabaseHostFormRequest extends AdminFormRequest
1818
*/
1919
public function rules()
2020
{
21+
if (! $this->has('node_id')) {
22+
$this->merge(['node_id' => null]);
23+
}
24+
2125
if ($this->method() !== 'POST') {
2226
return DatabaseHost::getUpdateRulesForId($this->route()->parameter('host')->id);
2327
}

app/Models/DatabaseHost.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,22 +63,21 @@ class DatabaseHost extends Model implements CleansAttributes, ValidableContract
6363
'host' => 'required',
6464
'port' => 'required',
6565
'username' => 'required',
66-
'node_id' => 'sometimes|required',
66+
'node_id' => 'sometimes',
6767
];
6868

6969
/**
7070
* Validation rules to assign to this model.
7171
*
7272
* @var array
73-
* @todo the node_id field doesn't validate correctly if no node is provided in request
7473
*/
7574
protected static $dataIntegrityRules = [
7675
'name' => 'string|max:255',
7776
'host' => 'ip|unique:database_hosts,host',
7877
'port' => 'numeric|between:1,65535',
7978
'username' => 'string|max:32',
8079
'password' => 'nullable|string',
81-
'node_id' => 'nullable|exists:nodes,id',
80+
'node_id' => 'nullable|integer|exists:nodes,id',
8281
];
8382

8483
/**

resources/themes/pterodactyl/admin/databases/index.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@
103103
<div class="form-group">
104104
<label for="pNodeId" class="form-label">Linked Node</label>
105105
<select name="node_id" id="pNodeId" class="form-control">
106-
<option value="null">None</option>
106+
<option value="">None</option>
107107
@foreach($locations as $location)
108108
<optgroup label="{{ $location->short }}">
109109
@foreach($location->nodes as $node)

0 commit comments

Comments
 (0)