A platform for community discussion. Free, open, simple.
FIX: Do not error when importing a theme with empty files
David Taylor428536788ce1
diff --git a/app/models/remote_theme.rb b/app/models/remote_theme.rbindex 895cc17b5e4..8bda9237711 100644--- a/app/models/remote_theme.rb+++ b/app/models/remote_theme.rb@@ -149,7 +149,7 @@ class RemoteTheme < ActiveRecord::Baseend# Destroy fields that no longer exist in the remote theme- field_ids_to_destroy = theme.theme_fields.pluck(:id) - updated_fields.map(&:id)+ field_ids_to_destroy = theme.theme_fields.pluck(:id) - updated_fields.map { |tf| tf&.id }ThemeField.where(id: field_ids_to_destroy).destroy_allif !skip_updatediff --git a/spec/models/remote_theme_spec.rb b/spec/models/remote_theme_spec.rbindex eca58289ac6..2a9ae32ae7d 100644--- a/spec/models/remote_theme_spec.rb+++ b/spec/models/remote_theme_spec.rb@@ -47,6 +47,7 @@ describe RemoteTheme do"about.json" => about_json,"desktop/desktop.scss" => scss_data,"scss/file.scss" => ".class1{color:red}",+ "scss/empty.scss" => "","common/header.html" => "I AM HEADER","common/random.html" => "I AM SILLY","common/embedded.scss" => "EMBED",