From: Matthias Schmidt Date: Fri, 25 Aug 2017 09:13:05 +0000 (+0200) Subject: Only test instant emails for notifications triggered once X-Git-Tag: 3.1.0_Alpha_2~27 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=c41af21907eb1a8481ed0645264b71fbbb8cf112;p=GitHub%2FWoltLab%2FWCF.git Only test instant emails for notifications triggered once See #2359 --- diff --git a/wcfsetup/install/files/acp/templates/devtoolsNotificationTestDialog.tpl b/wcfsetup/install/files/acp/templates/devtoolsNotificationTestDialog.tpl index 611aeb7e31..8bd53e0b38 100644 --- a/wcfsetup/install/files/acp/templates/devtoolsNotificationTestDialog.tpl +++ b/wcfsetup/install/files/acp/templates/devtoolsNotificationTestDialog.tpl @@ -49,7 +49,7 @@
{lang}wcf.acp.devtools.notificationTest.instantEmail{/lang}
{$event[instantEmail]}
- {else} + {elseif $event[instantEmailException]|isset}
{lang}wcf.acp.devtools.notificationTest.instantEmail.exception{/lang}
{$event[instantEmailException]}
@@ -111,8 +111,10 @@
{foreach from=$events item=event} -
{$event[description]}
-
{if $event[instantEmail]|isset}{$event[instantEmail]}{else}{$event[instantEmailException]}{/if}
+ {if $event[instantEmail]|isset || $event[instantEmailException]|isset} +
{$event[description]}
+
{if $event[instantEmail]|isset}{$event[instantEmail]}{else}{$event[instantEmailException]}{/if}
+ {/if} {/foreach}
diff --git a/wcfsetup/install/files/lib/data/user/notification/event/UserNotificationEventAction.class.php b/wcfsetup/install/files/lib/data/user/notification/event/UserNotificationEventAction.class.php index e875933e4b..f82b580def 100644 --- a/wcfsetup/install/files/lib/data/user/notification/event/UserNotificationEventAction.class.php +++ b/wcfsetup/install/files/lib/data/user/notification/event/UserNotificationEventAction.class.php @@ -162,16 +162,19 @@ class UserNotificationEventAction extends AbstractDatabaseObjectAction { $errors++; } - try { - $eventData['instantEmail'] = TestableUserNotificationEventHandler::getInstance()->getEmailBody($event, 'instant'); - } - catch (\Exception $e) { - $eventData['instantEmailException'] = $getRenderedException($e); - $errors++; - } - catch (\Throwable $e) { - $eventData['instantEmailException'] = $getRenderedException($e); - $errors++; + // for instant emails, a notification can only be triggered once + if ($event->getNotification()->timesTriggered == 1) { + try { + $eventData['instantEmail'] = TestableUserNotificationEventHandler::getInstance()->getEmailBody($event, 'instant'); + } + catch (\Exception $e) { + $eventData['instantEmailException'] = $getRenderedException($e); + $errors++; + } + catch (\Throwable $e) { + $eventData['instantEmailException'] = $getRenderedException($e); + $errors++; + } } }