From 6b3190103226fe703a3da5abec75f9ddf2b2a187 Mon Sep 17 00:00:00 2001
From: =?utf8?q?Tim=20D=C3=BCsterhus?=
Date: Sun, 19 Jun 2016 19:40:22 +0200
Subject: [PATCH] Limit the number of notifications in daily mail
---
.../templates/email_dailyNotification.tpl | 12 ++++++---
wcfsetup/install/lang/de.xml | 25 +++++++++++++------
wcfsetup/install/lang/en.xml | 25 +++++++++++++------
3 files changed, 43 insertions(+), 19 deletions(-)
diff --git a/com.woltlab.wcf/templates/email_dailyNotification.tpl b/com.woltlab.wcf/templates/email_dailyNotification.tpl
index d476740ee3..814991d547 100644
--- a/com.woltlab.wcf/templates/email_dailyNotification.tpl
+++ b/com.woltlab.wcf/templates/email_dailyNotification.tpl
@@ -1,10 +1,14 @@
+{assign var='maximum' value=7}
+{if $notifications|count == $maximum + 1}{assign var='maximum' value=$maximum + 1}{/if}
+{assign var='remaining' value=$notifications|count}
+{assign var='remaining' value=$remaining-$maximum}
{if $mimeType === 'text/plain'}
{capture assign='content'}
{lang}wcf.user.notification.mail.daily.plaintext.intro{/lang}
---------------
-{implode from=$notifications item='notification' glue="\n---------------\n\n"}
+{implode from=$notifications|array_slice:0:$maximum item='notification' glue="\n---------------\n\n"}
{assign var='event' value=$notification[event]}
{assign var='notificationContent' value=$notification[notificationContent]}
{assign var='notificationType' value=$notification[notificationType]}
@@ -13,14 +17,14 @@
{/implode}
---------------
-{*lang}TODO: wcf.user.notification.mail.daily.plaintext.outro{/lang*}
+{lang}wcf.user.notification.mail.daily.plaintext.outro{/lang}
{/capture}
{include file='email_plaintext'}
{else}
{capture assign='content'}
{lang}wcf.user.notification.mail.daily.html.intro{/lang}
- {foreach from=$notifications item='notification'}
+ {foreach from=$notifications|array_slice:0:$maximum item='notification'}
{assign var='event' value=$notification[event]}
{assign var='notificationContent' value=$notification[notificationContent]}
{assign var='notificationType' value=$notification[notificationType]}
@@ -33,7 +37,7 @@
{/foreach}
- {*lang}TODO: wcf.user.notification.mail.daily.html.outro{/lang*}
+ {lang}wcf.user.notification.mail.daily.html.outro{/lang}
{/capture}
{include file='email_html'}
{/if}
diff --git a/wcfsetup/install/lang/de.xml b/wcfsetup/install/lang/de.xml
index 0f511819b5..6a4a4e5de4 100644
--- a/wcfsetup/install/lang/de.xml
+++ b/wcfsetup/install/lang/de.xml
@@ -3269,17 +3269,26 @@ Benachrichtigungen auf {PAGE_TITLE|language
- getUser()->username},
-{if LANGUAGE_USE_INFORMAL_VARIANT}du hast{else}Sie haben{/if} derzeit insgesamt {#$notifications|count} ungelesene Benachrichtigungen, die älter als 24 Stunden sind:]]>
+{if LANGUAGE_USE_INFORMAL_VARIANT}Du hast{else}Sie haben{/if} derzeit insgesamt {#$notifications|count} ungelesene Benachrichtigungen, die älter als 24 Stunden sind:]]>
+ - $maximum}{if LANGUAGE_USE_INFORMAL_VARIANT}Besuche deine{else}Besuchen Sie Ihre{/if} Benachrichtigungs-Ãbersicht [URL:{link controller='NotificationList' isEmail=true}{/link}], um auch die restlichen {#$remaining} Benachrichtigungen einzusehen.
+
+{/if}Diese E-Mail ist eine automatische Benachrichtigung. BITTE {if LANGUAGE_USE_INFORMAL_VARIANT}ANTWORTE{else}ANTWORTEN SIE{/if} NICHT AUF DIESE E-MAIL.
+
+{if LANGUAGE_USE_INFORMAL_VARIANT}Besuche deine{else}Besuchen Sie Ihre{/if} Benachrichtigungseinstellungen [URL:{link controller='NotificationSettings' isEmail=true}{/link}], um die
+Benachrichtigungen auf {@PAGE_TITLE|language} [URL:{link isEmail=true}{/link}] nach {if LANGUAGE_USE_INFORMAL_VARIANT}deinen{else}Ihren{/if} Wünschen zu konfigurieren.
+
+Wenn {if LANGUAGE_USE_INFORMAL_VARIANT}du{else}Sie{/if} keine E-Mail-Benachrichtigungen mehr erhalten {if LANGUAGE_USE_INFORMAL_VARIANT}möchtest{else}möchten{/if}, dann {if LANGUAGE_USE_INFORMAL_VARIANT}kannst du{else}können Sie{/if} diese direkt abbestellen: {link controller='NotificationDisable' isEmail=true}userID={@$mailbox->getUser()->userID}&token={@$mailbox->getUser()->notificationMailToken}{/link}.]]>
- Hallo {@$mailbox->getUser()->username},
-
{if LANGUAGE_USE_INFORMAL_VARIANT}du hast{else}Sie haben{/if} haben derzeit insgesamt {#$notifications|count} ungelesene Benachrichtigungen, die älter als 24 Stunden sind:
]]>
- - {if LANGUAGE_USE_INFORMAL_VARIANT}Du hast{else}Sie haben{/if} derzeit insgesamt {#$notifications|count} ungelesene Benachrichtigungen, die älter als 24 Stunden sind:
]]>
+ - $maximum}
{if LANGUAGE_USE_INFORMAL_VARIANT}Besuche{else}Besuchen Sie{/if} {if LANGUAGE_USE_INFORMAL_VARIANT}deine{else}Ihre{/if} Benachrichtigungs-Ãbersicht, um auch die restlichen {#$remaining} Benachrichtigungen einzusehen.
{/if}
+
+Diese E-Mail ist eine automatische Benachrichtigung. Bitte {if LANGUAGE_USE_INFORMAL_VARIANT}antworte{else}antworten Sie{/if} nicht auf diese E-Mail.
+
+{if LANGUAGE_USE_INFORMAL_VARIANT}Besuche deine{else}Besuchen Sie Ihre{/if} Benachrichtigungseinstellungen, um die
+Benachrichtigungen auf {PAGE_TITLE|language} nach {if LANGUAGE_USE_INFORMAL_VARIANT}deinen{else}Ihren{/if} Wünschen zu konfigurieren.
-{if LANGUAGE_USE_INFORMAL_VARIANT}Möchtest du{else}Möchten Sie{/if} diese E-Mail-Benachrichtigung in Zukunft nicht mehr erhalten, {if LANGUAGE_USE_INFORMAL_VARIANT}kannst du{else}können Sie{/if} folgenden Link aufrufen, um die Benachrichtigung abzuschalten:
-{link controller='NotificationDisable' isEmail=true}userID={@$user->userID}&token={@$token}{/link}]]>
+Wenn {if LANGUAGE_USE_INFORMAL_VARIANT}du{else}Sie{/if} keine E-Mail-Benachrichtigungen mehr erhalten {if LANGUAGE_USE_INFORMAL_VARIANT}möchtest{else}möchten{/if}, dann {if LANGUAGE_USE_INFORMAL_VARIANT}kannst du{else}können Sie{/if} diese direkt abbestellen.
]]>
- getAuthor()->userID}Ein Gast{else}{@$event->getAuthor()->username} [URL:{link controller='User' object=$event->getAuthor() isEmail=true}{/link}]{/if}{if $count > 1 && $count < 4}{if $count == 2 && !$guestTimesTriggered} und {else}, {/if}{@$authors[1]->username} [URL:{link controller='User' object=$authors[1] isEmail=true}{/link}]{if $count == 3}{if !$guestTimesTriggered} und {else}, {/if}{@$authors[2]->username} [URL:{link controller='User' object=$authors[2] isEmail=true}{/link}]{/if}{elseif $count >= 4}{if $guestTimesTriggered},{else} und{/if} {#$count-1} weitere Benutzer{/if}{if $guestTimesTriggered} und {if $guestTimesTriggered == 1}ein Gast{else}{#$guestTimesTriggered} Gäste{/if}{/if}]]>
- getAuthor()->userID}Ein Gast{else}{@$event->getAuthor()->username}{/if}{if $count > 1 && $count < 4}{if $count == 2 && !$guestTimesTriggered} und {else}, {/if}{@$authors[1]->username}{if $count == 3}{if !$guestTimesTriggered} und {else}, {/if}{@$authors[2]->username}{/if}{elseif $count >= 4}{if $guestTimesTriggered},{else} und{/if} {#$count-1} weitere Benutzer{/if}{if $guestTimesTriggered} und {if $guestTimesTriggered == 1}ein Gast{else}{#$guestTimesTriggered} Gäste{/if}{/if}]]>
diff --git a/wcfsetup/install/lang/en.xml b/wcfsetup/install/lang/en.xml
index edb1585730..8900fc0652 100644
--- a/wcfsetup/install/lang/en.xml
+++ b/wcfsetup/install/lang/en.xml
@@ -3307,16 +3307,27 @@ your notifications on {PAGE_TITLE|language}
- getUser()->username},
you currently have got {#$notifications|count} unread notifications that are older than 24 hours:]]>
- - Hallo {@$mailbox->getUser()->username},
+
- $maximum}Visit your notification list [URL:{link controller='NotificationList' isEmail=true}{/link}] to view the remaining {#$remaining} notifications.
+
+{/if}This is an automatic notification, PLEASE DO NOT REPLY TO THIS EMAIL!
+
+Visit your notification settings [URL:{link controller='NotificationSettings' isEmail=true}{/link}] to configure
+your notifications on {@PAGE_TITLE|language} [URL:{link isEmail=true}{/link}] as you wish.
+
+If you wish to disable all email notifications you can do so by visiting:
+{link controller='NotificationDisable' isEmail=true}userID={@$mailbox->getUser()->userID}&token={@$mailbox->getUser()->notificationMailToken}{/link}]]>
+ - Dear {@$mailbox->getUser()->username},
you currently have got {#$notifications|count} unread notifications that are older than 24 hours:
]]>
- - {if $notifications|count > $maximum}Visit your notification list to view the remaining {#$remaining} notifications.{/if}
-If you do not want to receive further email notifications for this event, you can quickly disable it by opening the link below:
-{link controller='NotificationDisable' isEmail=true}userID={@$user->userID}&token={@$token}{/link}]]>
+This is an automatic notification, please do not reply to this email!
+
+Visit your notification settings to configure
+your notifications on {PAGE_TITLE|language} as you wish.
+
+You can disable all email notifications as well.
]]>
+
- getAuthor()->userID}A guest{else}{@$event->getAuthor()->username} [URL:{link controller='User' object=$event->getAuthor() isEmail=true}{/link}]{/if}{if $count > 1 && $count < 4}{if $count == 2 && !$guestTimesTriggered} and {else}, {/if}{@$authors[1]->username} [URL:{link controller='User' object=$authors[1] isEmail=true}{/link}]{if $count == 3}{if !$guestTimesTriggered} and {else}, {/if}{@$authors[2]->username} [URL:{link controller='User' object=$authors[2] isEmail=true}{/link}]{/if}{elseif $count >= 4}{if $guestTimesTriggered},{else} and{/if} {#$count-1} weitere Benutzer{/if}{if $guestTimesTriggered} and {if $guestTimesTriggered == 1}a guest{else}{#$guestTimesTriggered} guests{/if}{/if}]]>
- getAuthor()->userID}A guest{else}{@$event->getAuthor()->username}{/if}{if $count > 1 && $count < 4}{if $count == 2 && !$guestTimesTriggered} and {else}, {/if}{@$authors[1]->username}{if $count == 3}{if !$guestTimesTriggered} and {else}, {/if}{@$authors[2]->username}{/if}{elseif $count >= 4}{if $guestTimesTriggered},{else} and{/if} {#$count-1} other users{/if}{if $guestTimesTriggered} and {if $guestTimesTriggered == 1}a guest{else}{#$guestTimesTriggered} guests{/if}{/if}]]>
--
2.20.1