From 372cfc1e6d6f0e98df0a1ed0a59e752da9424aec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mois=C3=A9s=20Calzado?= Date: Mon, 20 Dec 2021 19:13:31 +0100 Subject: [PATCH] Add check before destroying dependent visualizations --- app/models/carto/user_table.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/models/carto/user_table.rb b/app/models/carto/user_table.rb index 9e385d2f2f..c618519871 100644 --- a/app/models/carto/user_table.rb +++ b/app/models/carto/user_table.rb @@ -13,6 +13,8 @@ end module Carto class UserTable < ActiveRecord::Base + attr_accessor :skip_destroy_dependent_visualizations + PRIVACY_PRIVATE = 0 PRIVACY_PUBLIC = 1 PRIVACY_LINK = 2 @@ -68,7 +70,7 @@ module Carto before_destroy :ensure_not_viewer before_destroy :cache_dependent_visualizations, unless: :destroyed? before_destroy :backup_visualizations, unless: :destroyed? - after_destroy :destroy_dependent_visualizations + after_destroy :destroy_dependent_visualizations, unless: :skip_destroy_dependent_visualizations after_destroy :service_after_destroy def geometry_types