Skip to content

Node.js based forum software built for the modern web

feat: #5274

Barış Soner Uşaklı4e9b10ab7605
diff --git a/install/data/defaults.json b/install/data/defaults.json
index d8ae3a488f..05b16670cc 100644
--- a/install/data/defaults.json
+++ b/install/data/defaults.json
@@ -123,6 +123,7 @@
"maximumRelatedTopics": 0,
"disableEmailSubscriptions": 0,
"emailConfirmInterval": 10,
+ "removeEmailNotificationImages": 0,
"inviteExpiration": 7,
"digestHour": 17,
"passwordExpiryDays": 0,
diff --git a/public/language/en-GB/admin/settings/email.json b/public/language/en-GB/admin/settings/email.json
index f6ade9cfc9..839fd2b6f6 100644
--- a/public/language/en-GB/admin/settings/email.json
+++ b/public/language/en-GB/admin/settings/email.json
@@ -4,7 +4,7 @@
"address-help": "The following email address refers to the email that the recipient will see in the \"From\" and \"Reply To\" fields.",
"from": "From Name",
"from-help": "The from name to display in the email.",
-
+
"smtp-transport": "SMTP Transport",
"smtp-transport.enabled": "Use an external email server to send emails",
"smtp-transport-help": "You can select from a list of well-known services or enter a custom one.",
@@ -35,5 +35,7 @@
"subscriptions": "Email Digests",
"subscriptions.disable": "Disable email digests",
"subscriptions.hour": "Digest Hour",
- "subscriptions.hour-help": "Please enter a number representing the hour to send scheduled email digests (e.g. <code>0</code> for midnight, <code>17</code> for 5:00pm). Keep in mind that this is the hour according to the server itself, and may not exactly match your system clock.<br /> The approximate server time is: <span id=\"serverTime\"></span><br /> The next daily digest is scheduled to be sent <span id=\"nextDigestTime\"></span>"
+ "subscriptions.hour-help": "Please enter a number representing the hour to send scheduled email digests (e.g. <code>0</code> for midnight, <code>17</code> for 5:00pm). Keep in mind that this is the hour according to the server itself, and may not exactly match your system clock.<br /> The approximate server time is: <span id=\"serverTime\"></span><br /> The next daily digest is scheduled to be sent <span id=\"nextDigestTime\"></span>",
+ "notifications.settings": "Email notification settings",
+ "notifications.remove-images": "Remove images from email notifications"
}
\ No newline at end of file
diff --git a/src/notifications.js b/src/notifications.js
index d92aa71e8f..72e6e7ee07 100644
--- a/src/notifications.js
+++ b/src/notifications.js
@@ -175,6 +175,9 @@ async function pushToUids(uids, notification) {
notification['cta-type'] = notification.type;
}
let body = notification.bodyLong || '';
+ if (meta.config.removeEmailNotificationImages) {
+ body = body.replace(/<img[^>]*>/, '');
+ }
body = posts.relativeToAbsolute(body, posts.urlRegex);
body = posts.relativeToAbsolute(body, posts.imgRegex);
await async.eachLimit(uids, 3, function (uid, next) {
diff --git a/src/views/admin/settings/email.tpl b/src/views/admin/settings/email.tpl
index df1d2ce84d..3e54b08e1f 100644
--- a/src/views/admin/settings/email.tpl
+++ b/src/views/admin/settings/email.tpl
@@ -154,4 +154,18 @@
</div>
</div>
+<div class="row">
+ <div class="col-sm-2 col-xs-12 settings-header">[[admin/settings/email:notifications.settings]]</div>
+ <div class="col-sm-10 col-xs-12">
+ <form>
+ <div class="checkbox">
+ <label for="removeEmailNotificationImages" class="mdl-switch mdl-js-switch mdl-js-ripple-effect">
+ <input class="mdl-switch__input" type="checkbox" id="removeEmailNotificationImages" data-field="removeEmailNotificationImages" name="removeEmailNotificationImages" />
+ <span class="mdl-switch__label">[[admin/settings/email:notifications.remove-images]]</span>
+ </label>
+ </div>
+ </form>
+ </div>
+</div>
+
<!-- IMPORT admin/partials/settings/footer.tpl -->