From 3da2e85855f5fd1379a20ae3f437fad50f7344cb Mon Sep 17 00:00:00 2001
From: Penar Musaraj <pmusaraj@gmail.com>
Date: Wed, 3 Feb 2021 22:44:07 -0500
Subject: [PATCH] FIX: Save updated remote theme, only update enabled
 themes/components (#11960)

---
 lib/tasks/themes.rake | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/tasks/themes.rake b/lib/tasks/themes.rake
index 0d52090e99d..3ac9c33672d 100644
--- a/lib/tasks/themes.rake
+++ b/lib/tasks/themes.rake
@@ -53,11 +53,12 @@ end
 
 desc "Update themes & theme components"
 task "themes:update" => :environment do |task, args|
-  Theme.where(auto_update: true).find_each do |theme|
+  Theme.where(auto_update: true, enabled: true).find_each do |theme|
     begin
       if theme.remote_theme.present?
         puts "Updating #{theme.name}..."
         theme.remote_theme.update_from_remote
+        theme.save!
       end
     rescue => e
       STDERR.puts "Failed to update #{theme.name}"