🐛 Fixed empty icon crashing signup embed preview (#17022)

closes https://github.com/TryGhost/Team/issues/3471

- after adding and removing an icon, icon settings passed an undefined
icon to the signup form's all-in-one style. The AIO conditions didn't
take that into account and caused the entire component to crash.

<!-- Leave the line below if you'd like GitHub Copilot to generate a
summary from your commit -->
<!--
copilot:summary
-->
### <samp>🤖 Generated by Copilot at 9e1aea3</samp>

Fix signup form embed code generation when icon is not set. Add a check
for `this.settings.icon` in `signup-form-embed.js` before replacing
image path.
This commit is contained in:
Ronald Langeveld 2023-06-14 15:13:49 +02:00 committed by Daniel Lockyer
parent 8cb8b84786
commit 49f936b098
No known key found for this signature in database

View File

@ -101,7 +101,9 @@ export default class SignupFormEmbedModal extends Component {
if (this.style === 'all-in-one') { if (this.style === 'all-in-one') {
// We serve twice the size of the icon to support high resolution screens // We serve twice the size of the icon to support high resolution screens
// (note that you'll need to change the resolution in the backend config as well, as not all resolutions are supported) // (note that you'll need to change the resolution in the backend config as well, as not all resolutions are supported)
options.icon = this.settings.icon.replace(/\/content\/images\//, '/content/images/size/w192h192/'); if (this.settings.icon || !this.settings.icon === '') {
options.icon = this.settings.icon.replace(/\/content\/images\//, '/content/images/size/w192h192/');
}
options.title = this.settings.title; options.title = this.settings.title;
options.description = this.settings.description; options.description = this.settings.description;