A platform for community discussion. Free, open, simple.
FIX: Update about/license URLs when updating theme from remote source
David Taylor59028035df70
diff --git a/app/models/remote_theme.rb b/app/models/remote_theme.rbindex 70ac5160937..6b2e84de72d 100644--- a/app/models/remote_theme.rb+++ b/app/models/remote_theme.rb@@ -139,8 +139,8 @@ class RemoteTheme < ActiveRecord::Basetheme.set_field(target: :translations, name: locale, value: value)end- self.license_url ||= theme_info["license_url"]- self.about_url ||= theme_info["about_url"]+ self.license_url = theme_info["license_url"]+ self.about_url = theme_info["about_url"]if !skip_updateself.remote_updated_at = Time.zone.nowdiff --git a/spec/models/remote_theme_spec.rb b/spec/models/remote_theme_spec.rbindex 9e7789bc01f..490ac1694ea 100644--- a/spec/models/remote_theme_spec.rb+++ b/spec/models/remote_theme_spec.rb@@ -18,11 +18,11 @@ describe RemoteTheme dorepo_dirend- def about_json(love_color: "FAFAFA", color_scheme_name: "Amazing")+ def about_json(love_color: "FAFAFA", color_scheme_name: "Amazing", about_url: "https://www.site.com/about")<<~JSON{"name": "awesome theme",- "about_url": "https://www.site.com/about",+ "about_url": "#{about_url}","license_url": "https://www.site.com/license","assets": {"font": "assets/awesome.woff2"@@ -99,7 +99,7 @@ describe RemoteTheme doexpect(scheme.colors.find_by(name: 'love').hex).to eq('fafafa')File.write("#{initial_repo}/common/header.html", "I AM UPDATED")- File.write("#{initial_repo}/about.json", about_json(love_color: "EAEAEA"))+ File.write("#{initial_repo}/about.json", about_json(love_color: "EAEAEA", about_url: "https://newsite.com/about"))File.write("#{initial_repo}/settings.yml", "integer_setting: 32")`cd #{initial_repo} && git add settings.yml`@@ -131,6 +131,7 @@ describe RemoteTheme doexpect(@theme.settings.first.value).to eq(32)expect(remote.remote_updated_at).to eq(time)+ expect(remote.about_url).to eq("https://newsite.com/about")# It should be able to remove old colors as wellFile.write("#{initial_repo}/about.json", about_json(love_color: "BABABA", color_scheme_name: "Amazing 2"))