Disable last step in UI for already sent standard emails
[MAILPOET-2195]
This commit is contained in:
committed by
Jack Kitterhing
parent
24d5125ba7
commit
3fba00c1e5
@ -97,7 +97,7 @@
|
||||
color: $error-text-color;
|
||||
margin-top: 10px;
|
||||
text-align: right;
|
||||
width: $sidebar-width - 20px;
|
||||
width: $sidebar-width;
|
||||
}
|
||||
|
||||
.mailpoet_save_dropdown_down {
|
||||
|
@ -248,6 +248,7 @@ Module.SaveView = Marionette.View.extend({
|
||||
},
|
||||
validateNewsletter: function (jsonObject) {
|
||||
var body = '';
|
||||
var newsletter;
|
||||
if (!App._contentContainer.isValid()) {
|
||||
this.showValidationError(App._contentContainer.validationError);
|
||||
return;
|
||||
@ -263,7 +264,8 @@ Module.SaveView = Marionette.View.extend({
|
||||
return;
|
||||
}
|
||||
|
||||
if ((App.getNewsletter().get('type') === 'notification')
|
||||
newsletter = App.getNewsletter();
|
||||
if ((newsletter.get('type') === 'notification')
|
||||
&& body.indexOf('"type":"automatedLatestContent"') < 0
|
||||
&& body.indexOf('"type":"automatedLatestContentLayout"') < 0
|
||||
) {
|
||||
@ -271,11 +273,16 @@ Module.SaveView = Marionette.View.extend({
|
||||
return;
|
||||
}
|
||||
|
||||
if (newsletter.get('type') === 'standard' && newsletter.get('status') === 'sent') {
|
||||
this.showValidationError(MailPoet.I18n.t('emailAlreadySent'));
|
||||
return;
|
||||
}
|
||||
|
||||
this.hideValidationError();
|
||||
},
|
||||
showValidationError: function (message) {
|
||||
var $el = this.$('.mailpoet_save_error');
|
||||
$el.text(message);
|
||||
$el.html(message.replace(/\. /g, '.<br>'));
|
||||
$el.removeClass('mailpoet_hidden');
|
||||
|
||||
this.$('.mailpoet_save_next').addClass('button-disabled');
|
||||
|
@ -309,6 +309,7 @@
|
||||
'failedToFetchRenderedPosts': __('Failed to fetch rendered posts'),
|
||||
'shortcodesWindowTitle': __('Select a shortcode'),
|
||||
'unsubscribeLinkMissing': __('All emails must include an "Unsubscribe" link. Add a footer widget to your email to continue.'),
|
||||
'emailAlreadySent': __('This email has already been sent. It can be edited, but not sent again. Duplicate this email if you want to send it again.'),
|
||||
'automatedLatestContentMissing': _x('Please add an “Automatic Latest Content” widget to the email from the right sidebar.', '(Please reuse the current translation used for the string “Automatic Latest Content”) This Error message is displayed when a user tries to send a “Post Notification” email without any “Automatic Latest Content” widget inside'),
|
||||
'newsletterPreviewEmailMissing': __('Enter an email address to send the preview newsletter to.'),
|
||||
'newsletterPreviewSent': __('Your test email has been sent!'),
|
||||
|
Reference in New Issue
Block a user