Use newsletter body content to check for unsubscribe link
We used the whole newsletter but there is a defaultContent which always contains unsubscribe link so the check always passed
This commit is contained in:
@@ -265,20 +265,24 @@ define([
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
validateNewsletter: function (jsonObject) {
|
validateNewsletter: function (jsonObject) {
|
||||||
|
var body = '';
|
||||||
var contents;
|
var contents;
|
||||||
if (!App._contentContainer.isValid()) {
|
if (!App._contentContainer.isValid()) {
|
||||||
this.showValidationError(App._contentContainer.validationError);
|
this.showValidationError(App._contentContainer.validationError);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
contents = JSON.stringify(jsonObject);
|
if (jsonObject && jsonObject.body && jsonObject.body.content) {
|
||||||
|
body = JSON.stringify(jsonObject.body.content);
|
||||||
|
}
|
||||||
if (App.getConfig().get('validation.validateUnsubscribeLinkPresent') &&
|
if (App.getConfig().get('validation.validateUnsubscribeLinkPresent') &&
|
||||||
contents.indexOf('[link:subscription_unsubscribe_url]') < 0 &&
|
body.indexOf('[link:subscription_unsubscribe_url]') < 0 &&
|
||||||
contents.indexOf('[link:subscription_unsubscribe]') < 0) {
|
body.indexOf('[link:subscription_unsubscribe]') < 0) {
|
||||||
this.showValidationError(MailPoet.I18n.t('unsubscribeLinkMissing'));
|
this.showValidationError(MailPoet.I18n.t('unsubscribeLinkMissing'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
contents = JSON.stringify(jsonObject);
|
||||||
if ((App.getNewsletter().get('type') === 'notification') &&
|
if ((App.getNewsletter().get('type') === 'notification') &&
|
||||||
contents.indexOf('"type":"automatedLatestContent"') < 0 &&
|
contents.indexOf('"type":"automatedLatestContent"') < 0 &&
|
||||||
contents.indexOf('"type":"automatedLatestContentLayout"') < 0
|
contents.indexOf('"type":"automatedLatestContentLayout"') < 0
|
||||||
|
Reference in New Issue
Block a user