From 3dd206ccf75ec772597ee1af76a237ca8c408441 Mon Sep 17 00:00:00 2001 From: Gio <34938366+giomxx@users.noreply.github.com> Date: Mon, 5 Jan 2026 00:44:46 +0000 Subject: [PATCH] Clear allocation notes on server deletion (#5157) --- CHANGELOG.md | 1 + .../Servers/ServerDeletionService.php | 6 ++++- ...3_091852_clear_unused_allocation_notes.php | 26 +++++++++++++++++++ 3 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 database/migrations/2024_07_13_091852_clear_unused_allocation_notes.php diff --git a/CHANGELOG.md b/CHANGELOG.md index 3cf63cf35..d8ed4e3b3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ This project follows [Semantic Versioning](http://semver.org) guidelines. * Fixes node description not being settable via the API. * Fixes 0-bytes files returning an error when attempting to upload. * Fixes nodes displaying the first available location even when that field was not edited and the node has a different value set. +* Fixes allocation notes not being reset when a server is deleted. ([#5157](https://github.com/pterodactyl/panel/pull/5157)) ### Changed * Minimum NodeJS version updated to 22 for building. diff --git a/app/Services/Servers/ServerDeletionService.php b/app/Services/Servers/ServerDeletionService.php index 714e22623..b06329ea4 100644 --- a/app/Services/Servers/ServerDeletionService.php +++ b/app/Services/Servers/ServerDeletionService.php @@ -35,7 +35,7 @@ class ServerDeletionService } /** - * Delete a server from the panel and remove any associated databases from hosts. + * Delete a server from the panel, clear any allocation notes, and remove any associated databases from hosts. * * @throws \Throwable * @throws \Pterodactyl\Exceptions\DisplayException @@ -77,6 +77,10 @@ class ServerDeletionService } } + // clear any allocation notes for the server + $server->allocations()->update(['notes' => null]); + + $server->delete(); }); } diff --git a/database/migrations/2024_07_13_091852_clear_unused_allocation_notes.php b/database/migrations/2024_07_13_091852_clear_unused_allocation_notes.php new file mode 100644 index 000000000..4e29fe37e --- /dev/null +++ b/database/migrations/2024_07_13_091852_clear_unused_allocation_notes.php @@ -0,0 +1,26 @@ +whereNull('server_id') + ->update(['notes' => null]); + + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + // Reverse not needed + } +};