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

This commit is contained in:
Jarek Radosz 2024-07-25 16:10:51 +02:00 committed by GitHub
parent e3f03c74c4
commit 4c7470d5cb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 2 deletions

View File

@ -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 # 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? if Rails.env.test? || Rails.env.development?
def self.import_theme_from_directory(directory) def self.import_theme_from_directory(directory)
update_theme(ThemeStore::DirectoryImporter.new(directory)) update_theme(ThemeStore::DirectoryImporter.new(directory), update_components: "none")
end end
end end
@ -109,6 +109,7 @@ class RemoteTheme < ActiveRecord::Base
theme.component = theme_info["component"].to_s == "true" theme.component = theme_info["component"].to_s == "true"
theme.child_components = child_components = theme_info["components"].presence || [] theme.child_components = child_components = theme_info["components"].presence || []
theme.skip_child_components_update = true if update_components == "none"
remote_theme = new remote_theme = new
remote_theme.theme = theme remote_theme.theme = theme

View File

@ -12,6 +12,7 @@ class Theme < ActiveRecord::Base
end end
attr_accessor :child_components attr_accessor :child_components
attr_accessor :skip_child_components_update
def self.cache def self.cache
@cache ||= DistributedCache.new("theme:compiler:#{BASE_COMPILER_VERSION}") @cache ||= DistributedCache.new("theme:compiler:#{BASE_COMPILER_VERSION}")
@ -152,7 +153,7 @@ class Theme < ActiveRecord::Base
end end
def update_child_components def update_child_components
if !component? && child_components.present? if !component? && child_components.present? && !skip_child_components_update
child_components.each do |url| child_components.each do |url|
url = ThemeStore::GitImporter.new(url.strip).url url = ThemeStore::GitImporter.new(url.strip).url
theme = RemoteTheme.find_by(remote_url: url)&.theme theme = RemoteTheme.find_by(remote_url: url)&.theme