Display ALC warning

[MAILPOET-1631]
This commit is contained in:
Pavel Dohnal
2018-11-13 12:32:58 +01:00
parent 19d13c5165
commit 13d35c4385
2 changed files with 8 additions and 8 deletions

View File

@ -266,7 +266,6 @@ define([
}, },
validateNewsletter: function (jsonObject) { validateNewsletter: function (jsonObject) {
var body = ''; var body = '';
var contents;
if (!App._contentContainer.isValid()) { if (!App._contentContainer.isValid()) {
this.showValidationError(App._contentContainer.validationError); this.showValidationError(App._contentContainer.validationError);
return; return;
@ -282,10 +281,9 @@ define([
return; return;
} }
contents = JSON.stringify(jsonObject);
if ((App.getNewsletter().get('type') === 'notification') && if ((App.getNewsletter().get('type') === 'notification') &&
contents.indexOf('"type":"automatedLatestContent"') < 0 && body.indexOf('"type":"automatedLatestContent"') < 0 &&
contents.indexOf('"type":"automatedLatestContentLayout"') < 0 body.indexOf('"type":"automatedLatestContentLayout"') < 0
) { ) {
this.showValidationError(MailPoet.I18n.t('automatedLatestContentMissing')); this.showValidationError(MailPoet.I18n.t('automatedLatestContentMissing'));
return; return;

View File

@ -129,11 +129,13 @@ define([
var newsletter = { get: sinon.stub().withArgs('type').returns('notification') }; var newsletter = { get: sinon.stub().withArgs('type').returns('notification') };
EditorApplication.getNewsletter = sinon.stub().returns(newsletter); EditorApplication.getNewsletter = sinon.stub().returns(newsletter);
view.validateNewsletter({ view.validateNewsletter({
body: {
content: { content: {
blocks: [ blocks: [
{ type: 'automatedLatestContent' } { type: 'automatedLatestContent' }
] ]
} }
}
}); });
expect(hideValidationErrorStub.callCount).to.be.equal(1); expect(hideValidationErrorStub.callCount).to.be.equal(1);
}); });