mirror of
https://github.com/discourse/discourse.git
synced 2025-06-05 14:07:30 +08:00
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:
@ -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: {
|
||||
|
Reference in New Issue
Block a user