0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-24 23:48:13 -05:00

Fixed sending email preview from post preview modal

refs https://github.com/TryGhost/Team/issues/459

- fixed incorrect tracked variable name for the email preview address
- fixed incorrect access of `this.post` instead of `this.args.post`
- re-throw any error that is encountered so the cause is not silently lost
This commit is contained in:
Kevin Ansfield 2021-02-01 08:59:08 +00:00 committed by Daniel Lockyer
parent b3980142ca
commit 28a2ff8259

View file

@ -27,14 +27,12 @@ export default class ModalPostPreviewEmailComponent extends Component {
@tracked html = '';
@tracked subject = '';
@tracked emailPreviewAddress = '';
@tracked previewEmailAddress = '';
@tracked sendPreviewEmailError = '';
get mailgunIsEnabled() {
return this.config.get('mailgunIsConfigured') ||
this.settings.get('mailgunApiKey') &&
this.settings.get('mailgunDomain') &&
this.settings.get('mailgunBaseUrl');
!!(this.settings.get('mailgunApiKey') && this.settings.get('mailgunDomain') && this.settings.get('mailgunBaseUrl'));
}
@action
@ -53,8 +51,8 @@ export default class ModalPostPreviewEmailComponent extends Component {
@task({drop: true})
*sendPreviewEmailTask() {
try {
const resourceId = this.post.id;
const testEmail = this.emailPreviewAddress.trim();
const resourceId = this.args.post.id;
const testEmail = this.previewEmailAddress.trim();
if (!validator.isEmail(testEmail)) {
this.sendPreviewEmailError = 'Please enter a valid email';
@ -86,6 +84,7 @@ export default class ModalPostPreviewEmailComponent extends Component {
}
this.sendPreviewEmailError = message;
throw error;
}
}
}