FIX: Update about/license URLs when updating theme from remote source
This commit is contained in:
parent
95f9a369a5
commit
59028035df
|
@ -139,8 +139,8 @@ class RemoteTheme < ActiveRecord::Base
|
||||||
theme.set_field(target: :translations, name: locale, value: value)
|
theme.set_field(target: :translations, name: locale, value: value)
|
||||||
end
|
end
|
||||||
|
|
||||||
self.license_url ||= theme_info["license_url"]
|
self.license_url = theme_info["license_url"]
|
||||||
self.about_url ||= theme_info["about_url"]
|
self.about_url = theme_info["about_url"]
|
||||||
|
|
||||||
if !skip_update
|
if !skip_update
|
||||||
self.remote_updated_at = Time.zone.now
|
self.remote_updated_at = Time.zone.now
|
||||||
|
|
|
@ -18,11 +18,11 @@ describe RemoteTheme do
|
||||||
repo_dir
|
repo_dir
|
||||||
end
|
end
|
||||||
|
|
||||||
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
|
<<~JSON
|
||||||
{
|
{
|
||||||
"name": "awesome theme",
|
"name": "awesome theme",
|
||||||
"about_url": "https://www.site.com/about",
|
"about_url": "#{about_url}",
|
||||||
"license_url": "https://www.site.com/license",
|
"license_url": "https://www.site.com/license",
|
||||||
"assets": {
|
"assets": {
|
||||||
"font": "assets/awesome.woff2"
|
"font": "assets/awesome.woff2"
|
||||||
|
@ -99,7 +99,7 @@ describe RemoteTheme do
|
||||||
expect(scheme.colors.find_by(name: 'love').hex).to eq('fafafa')
|
expect(scheme.colors.find_by(name: 'love').hex).to eq('fafafa')
|
||||||
|
|
||||||
File.write("#{initial_repo}/common/header.html", "I AM UPDATED")
|
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")
|
File.write("#{initial_repo}/settings.yml", "integer_setting: 32")
|
||||||
`cd #{initial_repo} && git add settings.yml`
|
`cd #{initial_repo} && git add settings.yml`
|
||||||
|
@ -131,6 +131,7 @@ describe RemoteTheme do
|
||||||
expect(@theme.settings.first.value).to eq(32)
|
expect(@theme.settings.first.value).to eq(32)
|
||||||
|
|
||||||
expect(remote.remote_updated_at).to eq(time)
|
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 well
|
# It should be able to remove old colors as well
|
||||||
File.write("#{initial_repo}/about.json", about_json(love_color: "BABABA", color_scheme_name: "Amazing 2"))
|
File.write("#{initial_repo}/about.json", about_json(love_color: "BABABA", color_scheme_name: "Amazing 2"))
|
||||||
|
|
Loading…
Reference in New Issue