Add an option to disable un/subscribe confirmation messages
This commit is contained in:
parent
3182566526
commit
10bd4614ef
6 changed files with 32 additions and 7 deletions
|
@ -48,11 +48,11 @@
|
|||
"handlebars": "^4.0.5",
|
||||
"hbs": "^4.0.0",
|
||||
"he": "^1.1.0",
|
||||
"html-to-text": "^2.1.0",
|
||||
"html-to-text": "^2.1.3",
|
||||
"humanize": "0.0.9",
|
||||
"is-url": "^1.2.1",
|
||||
"isemail": "^2.2.0",
|
||||
"jsdom": "^9.2.1",
|
||||
"jsdom": "^9.3.0",
|
||||
"juice": "^2.0.0",
|
||||
"mkdirp": "^0.5.1",
|
||||
"moment-timezone": "^0.5.4",
|
||||
|
|
|
@ -190,6 +190,9 @@ router.get('/edit/:id', passport.csrfProtection, (req, res, next) => {
|
|||
}, {
|
||||
key: 'LINK_BROWSER',
|
||||
value: 'URL to preview the message in a browser'
|
||||
}, {
|
||||
key: 'EMAIL',
|
||||
value: 'Email address'
|
||||
}, {
|
||||
key: 'FIRST_NAME',
|
||||
value: 'First name'
|
||||
|
|
|
@ -11,7 +11,7 @@ let url = require('url');
|
|||
|
||||
let settings = require('../lib/models/settings');
|
||||
|
||||
let allowedKeys = ['service_url', 'smtp_hostname', 'smtp_port', 'smtp_encryption', 'smtp_disable_auth', 'smtp_user', 'smtp_pass', 'admin_email', 'smtp_log', 'smtp_max_connections', 'smtp_max_messages', 'smtp_self_signed', 'default_from', 'default_address', 'default_subject', 'default_homepage', 'default_postaddress', 'default_sender', 'verp_hostname', 'verp_use', 'disable_wysiwyg', 'pgp_private_key', 'pgp_passphrase', 'ua_code', 'shoutout'];
|
||||
let allowedKeys = ['service_url', 'smtp_hostname', 'smtp_port', 'smtp_encryption', 'smtp_disable_auth', 'smtp_user', 'smtp_pass', 'admin_email', 'smtp_log', 'smtp_max_connections', 'smtp_max_messages', 'smtp_self_signed', 'default_from', 'default_address', 'default_subject', 'default_homepage', 'default_postaddress', 'default_sender', 'verp_hostname', 'verp_use', 'disable_wysiwyg', 'pgp_private_key', 'pgp_passphrase', 'ua_code', 'shoutout', 'disable_confirmations'];
|
||||
|
||||
router.all('/*', (req, res, next) => {
|
||||
if (!req.user) {
|
||||
|
@ -74,7 +74,7 @@ router.post('/update', passport.parseForm, passport.csrfProtection, (req, res) =
|
|||
});
|
||||
|
||||
// checkboxs are not included in value listing if left unchecked
|
||||
['smtp_log', 'smtp_self_signed', 'smtp_disable_auth', 'verp_use', 'disable_wysiwyg'].forEach(key => {
|
||||
['smtp_log', 'smtp_self_signed', 'smtp_disable_auth', 'verp_use', 'disable_wysiwyg', 'disable_confirmations'].forEach(key => {
|
||||
if (keys.indexOf(key) < 0) {
|
||||
keys.push(key);
|
||||
values.push('');
|
||||
|
|
|
@ -35,7 +35,7 @@ router.get('/subscribe/:cid', (req, res, next) => {
|
|||
return next(err);
|
||||
}
|
||||
|
||||
settings.list(['defaultHomepage', 'serviceUrl', 'pgpPrivateKey', 'defaultAddress', 'defaultFrom'], (err, configItems) => {
|
||||
settings.list(['defaultHomepage', 'serviceUrl', 'pgpPrivateKey', 'defaultAddress', 'defaultFrom', 'disableConfirmations'], (err, configItems) => {
|
||||
if (err) {
|
||||
return next(err);
|
||||
}
|
||||
|
@ -48,6 +48,10 @@ router.get('/subscribe/:cid', (req, res, next) => {
|
|||
hasPubkey: !!configItems.pgpPrivateKey
|
||||
});
|
||||
|
||||
if (configItems.disableConfirmations) {
|
||||
return;
|
||||
}
|
||||
|
||||
fields.list(list.id, (err, fieldList) => {
|
||||
if (err) {
|
||||
return log.error('Fields', err);
|
||||
|
@ -378,9 +382,13 @@ router.post('/:lcid/unsubscribe', passport.parseForm, passport.csrfProtection, (
|
|||
}
|
||||
});
|
||||
|
||||
settings.list(['defaultHomepage', 'defaultFrom', 'defaultAddress', 'serviceUrl'], (err, configItems) => {
|
||||
settings.list(['defaultHomepage', 'defaultFrom', 'defaultAddress', 'serviceUrl', 'disableConfirmations'], (err, configItems) => {
|
||||
if (err) {
|
||||
return next(err);
|
||||
return log.error('Settings', err);
|
||||
}
|
||||
|
||||
if (configItems.disableConfirmations) {
|
||||
return;
|
||||
}
|
||||
|
||||
mailer.sendMail({
|
||||
|
|
|
@ -47,6 +47,17 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="col-sm-offset-2 col-sm-10">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input type="checkbox" name="disable-confirmations" {{#if disableConfirmations}} checked {{/if}}> Disable subscription confirmation messages
|
||||
<span class="help-block">If checked then do not send a confirmation message that states the subscriber is now subscribed or unsubscribed. This does not disable double opt-in messages.</span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="ua-code" class="col-sm-2 control-label">Tracking ID</label>
|
||||
<div class="col-sm-10">
|
||||
|
|
|
@ -28,6 +28,9 @@
|
|||
</p>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
<code>[EMAIL]</code> – email address of the subscriber
|
||||
</li>
|
||||
<li>
|
||||
<code>[FIRST_NAME]</code> – first name of the subscriber
|
||||
</li>
|
||||
|
|
Loading…
Reference in a new issue