Fix database deletion; closes #4114

Co-Authored-By: Dawid <minerpl03@gmail.com>
This commit is contained in:
DaneEveritt 2022-06-05 13:28:46 -04:00
parent c0a3dea6d8
commit 8771597560
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
2 changed files with 11 additions and 19 deletions

View file

@ -3,6 +3,11 @@ This file is a running track of new features and fixes to each version of the pa
This project follows [Semantic Versioning](http://semver.org) guidelines. This project follows [Semantic Versioning](http://semver.org) guidelines.
## v1.8.2
### Fixed
* Fixes a bug causing a 404 error when attempting to delete a database from a server in the admin control panel.
* Fixes console input auto-capitalizing and auto-correcting when entering text on some mobile devices.
## v1.8.1 ## v1.8.1
### Fixed ### Fixed
* Fixes a bug causing mounts to return a 404 error when adding them to a server. * Fixes a bug causing mounts to return a 404 error when adding them to a server.

View file

@ -13,6 +13,7 @@ use Illuminate\Http\Request;
use Pterodactyl\Models\User; use Pterodactyl\Models\User;
use Pterodactyl\Models\Mount; use Pterodactyl\Models\Mount;
use Pterodactyl\Models\Server; use Pterodactyl\Models\Server;
use Pterodactyl\Models\Database;
use Pterodactyl\Models\MountServer; use Pterodactyl\Models\MountServer;
use Prologue\Alerts\AlertsMessageBag; use Prologue\Alerts\AlertsMessageBag;
use Pterodactyl\Exceptions\DisplayException; use Pterodactyl\Exceptions\DisplayException;
@ -344,18 +345,13 @@ class ServersController extends Controller
/** /**
* Resets the database password for a specific database on this server. * Resets the database password for a specific database on this server.
* *
* @param int $server * @return \Illuminate\Http\Response
*
* @return \Illuminate\Http\RedirectResponse
* *
* @throws \Throwable * @throws \Throwable
*/ */
public function resetDatabasePassword(Request $request, $server) public function resetDatabasePassword(Request $request, Server $server)
{ {
$database = $this->databaseRepository->findFirstWhere([ $database = $server->databases()->where('id', $request->input('database'))->findOrFail();
['server_id', '=', $server],
['id', '=', $request->input('database')],
]);
$this->databasePasswordService->handle($database); $this->databasePasswordService->handle($database);
@ -365,21 +361,12 @@ class ServersController extends Controller
/** /**
* Deletes a database from a server. * Deletes a database from a server.
* *
* @param int $server * @return \Illuminate\Http\Response
* @param int $database
*
* @return \Illuminate\Http\RedirectResponse
* *
* @throws \Exception * @throws \Exception
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
*/ */
public function deleteDatabase($server, $database) public function deleteDatabase(Server $server, Database $database)
{ {
$database = $this->databaseRepository->findFirstWhere([
['server_id', '=', $server],
['id', '=', $database],
]);
$this->databaseManagementService->delete($database); $this->databaseManagementService->delete($database);
return response('', 204); return response('', 204);