From d718a127c528857b58d212949acdb4e8314be6ba Mon Sep 17 00:00:00 2001 From: Ahmed Darrazi Date: Thu, 25 Dec 2025 03:25:27 +0100 Subject: [PATCH] fix: allow deleting previewed restore runs Treat previewed as deletable for hygiene; keeps partial deletable too. --- app/Models/RestoreRun.php | 4 ++-- tests/Unit/RestoreRunDeletableTest.php | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/Models/RestoreRun.php b/app/Models/RestoreRun.php index 9160725..2e93372 100644 --- a/app/Models/RestoreRun.php +++ b/app/Models/RestoreRun.php @@ -36,7 +36,7 @@ public function backupSet(): BelongsTo public function scopeDeletable($query) { - return $query->whereIn('status', ['completed', 'failed', 'aborted', 'completed_with_errors', 'partial']); + return $query->whereIn('status', ['completed', 'failed', 'aborted', 'completed_with_errors', 'partial', 'previewed']); } public function isDeletable(): bool @@ -44,6 +44,6 @@ public function isDeletable(): bool $status = strtolower(trim((string) $this->status)); $status = str_replace([' ', '-'], '_', $status); - return in_array($status, ['completed', 'failed', 'aborted', 'completed_with_errors', 'partial'], true); + return in_array($status, ['completed', 'failed', 'aborted', 'completed_with_errors', 'partial', 'previewed'], true); } } diff --git a/tests/Unit/RestoreRunDeletableTest.php b/tests/Unit/RestoreRunDeletableTest.php index 4db56f6..fa61f1c 100644 --- a/tests/Unit/RestoreRunDeletableTest.php +++ b/tests/Unit/RestoreRunDeletableTest.php @@ -24,6 +24,7 @@ 'aborted', 'completed_with_errors', 'partial', + 'previewed', 'running', 'pending', ]; @@ -52,6 +53,7 @@ 'completed_with_errors', 'failed', 'partial', + 'previewed', ]); });