Skip to content

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

FIX: Skip unfinished theme placeholders in `themes:update`

Régis Hanol497e76ff0e24
diff --git a/lib/tasks/themes.rake b/lib/tasks/themes.rake
index cf5d20c75b8..f7557e33671 100644
--- a/lib/tasks/themes.rake
+++ b/lib/tasks/themes.rake
@@ -292,6 +292,12 @@ def update_themes(version_cache: Concurrent::Map.new)
remote_theme = theme.remote_theme
next if remote_theme.blank? || remote_theme.remote_url.blank?
prefix = "[db:#{RailsMultisite::ConnectionManagement.current_db}] '#{theme.name}' - "
+
+ if remote_theme.placeholder?
+ puts "#{prefix} skipping, installation not finished"
+ next
+ end
+
puts "#{prefix} checking..."
cache_key =
diff --git a/spec/tasks/themes_spec.rb b/spec/tasks/themes_spec.rb
index 3fe94de04f9..949152a9726 100644
--- a/spec/tasks/themes_spec.rb
+++ b/spec/tasks/themes_spec.rb
@@ -307,5 +307,16 @@ RSpec.describe "tasks/themes" do
expect(theme.remote_theme.remote_version).to eq(original_remote_version)
expect(theme.remote_theme.local_version).to eq(original_local_version)
end
+
+ it "skips placeholders whose installation hasn't been finished" do
+ placeholder = Fabricate(:theme_with_remote_url, name: "private-theme")
+
+ stdout = nil
+ stderr = capture_stderr { stdout = capture_stdout { invoke_rake_task("themes:update") } }
+
+ expect(stderr).to be_blank
+ expect(stdout).to include("skipping, installation not finished")
+ expect(placeholder.remote_theme.reload.local_version).to be_nil
+ end
end
end