FIX: Do not error when importing a theme with empty files

This commit is contained in:
David Taylor 2019-04-15 15:46:47 +01:00
parent 6bbdf5b56e
commit 428536788c
2 changed files with 2 additions and 1 deletions

View File

@ -149,7 +149,7 @@ class RemoteTheme < ActiveRecord::Base
end
# 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_all
if !skip_update

View File

@ -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",