From ed2a45b2b9a90785a3c064f0d2a3214c4eb86e10 Mon Sep 17 00:00:00 2001 From: Abhishek Gupta Date: Wed, 27 Feb 2013 15:07:29 -0800 Subject: [PATCH] Fix for bug 916323 - making sure that we delete all applications and re-verify before force-deleting a domain --- controller/app/controllers/domains_controller.rb | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/controller/app/controllers/domains_controller.rb b/controller/app/controllers/domains_controller.rb index 3650360cc8c..d72d249f715 100644 --- a/controller/app/controllers/domains_controller.rb +++ b/controller/app/controllers/domains_controller.rb @@ -149,10 +149,15 @@ def destroy end if force - domain.applications.each do |app| - app.destroy_app + apps = domain.with(consistency: :strong).applications + while apps.count > 0 + apps.each do |app| + app.destroy_app + end + domain.with(consistency: :strong).reload + apps = domain.with(consistency: :strong).applications end - elsif not domain.applications.empty? + elsif not domain.with(consistency: :strong).applications.empty? return render_error(:bad_request, "Domain contains applications. Delete applications first or set force to true.", 128, "DELETE_DOMAIN") end