Fix UserProfileCommentResponse*UserNotificationEvent email notifications
authorTim Düsterhus <duesterhus@woltlab.com>
Fri, 29 Jul 2016 20:44:02 +0000 (22:44 +0200)
committerTim Düsterhus <duesterhus@woltlab.com>
Fri, 29 Jul 2016 20:47:13 +0000 (22:47 +0200)
wcfsetup/install/files/lib/system/user/notification/event/UserProfileCommentResponseOwnerUserNotificationEvent.class.php
wcfsetup/install/files/lib/system/user/notification/event/UserProfileCommentResponseUserNotificationEvent.class.php

index cdf4ab22455ad94a154ecf968ef0511b6c9c530f..aec85c19f647309b2ff1fafc0078e6f8d29f423c 100644 (file)
@@ -87,15 +87,13 @@ class UserProfileCommentResponseOwnerUserNotificationEvent extends AbstractShare
         * @inheritDoc
         */
        public function getEmailMessage($notificationType = 'instant') {
-               $comment = new Comment($this->getUserNotificationObject()->commentID);
-               $owner = new User($comment->objectID);
+               $comment = CommentRuntimeCache::getInstance()->getObject($this->getUserNotificationObject()->commentID);
+               $owner = UserProfileRuntimeCache::getInstance()->getObject($this->additionalData['objectID']);
                if ($comment->userID) {
-                       $commentAuthor = new User($comment->userID);
+                       $commentAuthor = UserProfileRuntimeCache::getInstance()->getObject($comment->userID);
                }
                else {
-                       $commentAuthor = new User(null, [
-                               'username' => $comment->username
-                       ]);
+                       $commentAuthor = UserProfile::getGuestUserProfile($comment->username);
                }
                
                $messageID = '<com.woltlab.wcf.user.profileComment.notification/'.$comment->commentID.'@'.Email::getHost().'>';
index ac7ea1e4b60dd4fc8a12a9d50d8202cff98c0da7..b9f699de770b0ba5e60a7f38625b71431a75353b 100644 (file)
@@ -1,5 +1,6 @@
 <?php
 namespace wcf\system\user\notification\event;
+use wcf\system\cache\runtime\CommentRuntimeCache;
 use wcf\system\cache\runtime\UserProfileRuntimeCache;
 use wcf\system\email\Email;
 
@@ -21,6 +22,7 @@ class UserProfileCommentResponseUserNotificationEvent extends AbstractSharedUser
         * @inheritDoc
         */
        protected function prepare() {
+               CommentRuntimeCache::getInstance()->cacheObjectID($this->getUserNotificationObject()->commentID);
                UserProfileRuntimeCache::getInstance()->cacheObjectID($this->additionalData['objectID']);
        }
        
@@ -71,6 +73,7 @@ class UserProfileCommentResponseUserNotificationEvent extends AbstractSharedUser
         * @inheritDoc
         */
        public function getEmailMessage($notificationType = 'instant') {
+               $comment = CommentRuntimeCache::getInstance()->getObject($this->getUserNotificationObject()->commentID);
                $owner = UserProfileRuntimeCache::getInstance()->getObject($this->additionalData['objectID']);
                
                $messageID = '<com.woltlab.wcf.user.profileComment.notification/'.$comment->commentID.'@'.Email::getHost().'>';