mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-10 23:36:14 -05:00
Fixed displaying empty from address in newsletter preview (#19169)
no issue When the from address of a newsletter is empty, and a custom sending domain is setup the preview would display 'From: Sitename ()' instead of 'From: Sitename (default@address)'. When a custom sending domain was setup, but a different from address was saved, we'll also no longer display it in the input fields - as it will also be ignored IRL.
This commit is contained in:
parent
d3b0a26e4d
commit
3ef427a504
1 changed files with 11 additions and 4 deletions
|
@ -26,7 +26,7 @@ export const renderSenderEmail = (newsletter: Newsletter, config: Config, defaul
|
||||||
if (newsletter.sender_email?.split('@')[1] === sendingDomain(config)) {
|
if (newsletter.sender_email?.split('@')[1] === sendingDomain(config)) {
|
||||||
return newsletter.sender_email;
|
return newsletter.sender_email;
|
||||||
} else {
|
} else {
|
||||||
return '';
|
return defaultEmailAddress || '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -169,8 +169,15 @@ const Sidebar: React.FC<{
|
||||||
|
|
||||||
// Pro users with custom sending domains
|
// Pro users with custom sending domains
|
||||||
if (hasSendingDomain(config)) {
|
if (hasSendingDomain(config)) {
|
||||||
const sendingEmail = renderSenderEmail(newsletter, config, defaultEmailAddress);
|
let sendingEmail = newsletter.sender_email || ''; // Do not use the rendered address here, because this field is editable and we otherwise can't have an empty field
|
||||||
const sendingEmailUsername = sendingEmail?.split('@')[0];
|
|
||||||
|
// It is possible we have an invalid saved email address, in that case it won't get used
|
||||||
|
// so we should display as if we are using the default = an empty address
|
||||||
|
if (sendingEmail && sendingEmail !== newsletterAddress) {
|
||||||
|
sendingEmail = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
const sendingEmailUsername = sendingEmail?.split('@')[0] || '';
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<TextField
|
<TextField
|
||||||
|
|
Loading…
Add table
Reference in a new issue