mirror of
https://github.com/coollabsio/coolify.git
synced 2026-11-06 13:10:37 -04:00
fix(resources): hide deleted resources on the environment page after the redirect
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
d30f582bfe
commit
887461ab2d
@@ -115,6 +115,8 @@ class Danger extends Component
|
||||
|
||||
try {
|
||||
$this->authorize('delete', $this->resource);
|
||||
// Soft delete first, so the environment page after the redirect does not list the resource.
|
||||
$this->resource->delete();
|
||||
DeleteResourceJob::dispatch(
|
||||
$this->resource,
|
||||
$this->delete_volumes,
|
||||
|
||||
@@ -64,7 +64,7 @@ test('delete returns error string when password is incorrect', function () {
|
||||
expect(Application::find($this->application->id))->not->toBeNull();
|
||||
});
|
||||
|
||||
test('delete redirects before dispatching resource cleanup after the response', function () {
|
||||
test('delete hides the resource before the redirect and dispatches cleanup after the response', function () {
|
||||
$service = Service::factory()->create([
|
||||
'environment_id' => $this->environment->id,
|
||||
'server_id' => $this->server->id,
|
||||
@@ -84,7 +84,9 @@ test('delete redirects before dispatching resource cleanup after the response',
|
||||
|
||||
expect($component->effects)->toHaveKey('redirectUsingNavigate', true);
|
||||
|
||||
expect(Service::find($service->id))->not->toBeNull();
|
||||
// The redirected environment page must not list the resource while the cleanup job still runs.
|
||||
expect(Service::find($service->id))->toBeNull()
|
||||
->and(Service::withTrashed()->find($service->id))->not->toBeNull();
|
||||
Queue::assertPushed(DeleteResourceJob::class, fn (DeleteResourceJob $job) => $job->resource->is($service));
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user