Skip to content

A platform for community discussion. Free, open, simple.

DEV: Don't try to update child themes in tests (#28080)

Jarek Radosz4c7470d5cb3f
diff --git a/app/models/remote_theme.rb b/app/models/remote_theme.rb
index 620f5de16aa..8b8452fd3d8 100644
--- a/app/models/remote_theme.rb
+++ b/app/models/remote_theme.rb
@@ -85,7 +85,7 @@ class RemoteTheme < ActiveRecord::Base
# This is only used in the development and test environment and is currently not supported for other environments
if Rails.env.test? || Rails.env.development?
def self.import_theme_from_directory(directory)
- update_theme(ThemeStore::DirectoryImporter.new(directory))
+ update_theme(ThemeStore::DirectoryImporter.new(directory), update_components: "none")
end
end
@@ -109,6 +109,7 @@ class RemoteTheme < ActiveRecord::Base
theme.component = theme_info["component"].to_s == "true"
theme.child_components = child_components = theme_info["components"].presence || []
+ theme.skip_child_components_update = true if update_components == "none"
remote_theme = new
remote_theme.theme = theme
diff --git a/app/models/theme.rb b/app/models/theme.rb
index 7eef07af10a..fbfb36c7eb8 100644
--- a/app/models/theme.rb
+++ b/app/models/theme.rb
@@ -12,6 +12,7 @@ class Theme < ActiveRecord::Base
end
attr_accessor :child_components
+ attr_accessor :skip_child_components_update
def self.cache
@cache ||= DistributedCache.new("theme:compiler:#{BASE_COMPILER_VERSION}")
@@ -152,7 +153,7 @@ class Theme < ActiveRecord::Base
end
def update_child_components
- if !component? && child_components.present?
+ if !component? && child_components.present? && !skip_child_components_update
child_components.each do |url|
url = ThemeStore::GitImporter.new(url.strip).url
theme = RemoteTheme.find_by(remote_url: url)&.theme