FIX: Only block local edits for git-sourced themes (#11450)

Themes uploaded as zip files are given a row in the `remote_themes` table to store metadata, even though they are not truly remote.
This commit is contained in:
David Taylor
2020-12-09 19:41:42 +00:00
committed by GitHub
parent 0116897ac9
commit d1d37473d4
4 changed files with 20 additions and 4 deletions

View File

@ -378,7 +378,7 @@ describe Admin::ThemesController do
theme: {
theme_fields: [
{ name: 'scss', target: 'common', value: '' },
{ name: 'test', target: 'common', value: 'filename.jpg', upload_id: 4 }
{ name: 'header', target: 'common', value: 'filename.jpg', upload_id: 4 }
]
}
}
@ -386,6 +386,22 @@ describe Admin::ThemesController do
expect(response.status).to eq(403)
end
it 'allows zip-imported theme fields to be locally edited' do
r = RemoteTheme.create!(remote_url: "")
theme.update!(remote_theme_id: r.id)
put "/admin/themes/#{theme.id}.json", params: {
theme: {
theme_fields: [
{ name: 'scss', target: 'common', value: '' },
{ name: 'header', target: 'common', value: 'filename.jpg', upload_id: 4 }
]
}
}
expect(response.status).to eq(200)
end
it 'updates a child theme' do
child_theme = Fabricate(:theme, component: true)
put "/admin/themes/#{child_theme.id}.json", params: {