From: Matthias Schmidt Date: Fri, 4 Aug 2017 17:57:19 +0000 (+0200) Subject: Fix authors for guest-only triggered test notifications X-Git-Tag: 3.1.0_Alpha_1~109 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=53ec065dafc0072a318f836915bb7794769175ae;p=GitHub%2FWoltLab%2FWCF.git Fix authors for guest-only triggered test notifications --- diff --git a/wcfsetup/install/files/lib/system/user/notification/TestableUserNotificationEventHandler.class.php b/wcfsetup/install/files/lib/system/user/notification/TestableUserNotificationEventHandler.class.php index 40a09d10f5..1b7ab6468e 100644 --- a/wcfsetup/install/files/lib/system/user/notification/TestableUserNotificationEventHandler.class.php +++ b/wcfsetup/install/files/lib/system/user/notification/TestableUserNotificationEventHandler.class.php @@ -224,6 +224,8 @@ class TestableUserNotificationEventHandler extends SingletonFactory { $maxGuestCount = 0; } + $unknownAuthor = UserProfile::getGuestUserProfile('Unknown Author'); + $events = []; foreach (LanguageFactory::getInstance()->getLanguages() as $language) { for ($authorCount = $minAuthorCount; $authorCount <= $maxAuthorCount; $authorCount++) { @@ -242,13 +244,20 @@ class TestableUserNotificationEventHandler extends SingletonFactory { 'language' => $language, 'timesTriggered' => $authorCount ])); + $event->setObject( $this->getUserNotification($firstAuthor, $authorCount, $guestCount, $additionalData), $object, - $firstAuthor, + $authorCount ? $firstAuthor : $unknownAuthor, $additionalData ); - $event->setAuthors(array_slice($authors, 0, $authorCount, true)); + + if ($authorCount) { + $event->setAuthors(array_slice($authors, 0, $authorCount, true)); + } + else { + $event->setAuthors([$unknownAuthor]); + } $events[] = $event; }