Fix UserProfileCommentResponseOwnerUserNotificationEvent::getLink()
authorFabii547 <Fabii547@users.noreply.github.com>
Sat, 18 Aug 2018 09:13:52 +0000 (11:13 +0200)
committerJoshua Rüsweg <josh@bastelstu.be>
Sun, 19 Aug 2018 13:28:04 +0000 (15:28 +0200)
UserProfileCommentResponseOwnerUserNotificationEvent::getLink() now returns the correct link when using an event listener on fireEvent@wcf\system\user\notification\UserNotificationHandler

Fix usage of the RuntimeCacheBuilder

wcfsetup/install/files/lib/system/user/notification/event/UserProfileCommentResponseOwnerUserNotificationEvent.class.php

index 93099710abf87de1f9479acedc94cb79fe999f0c..18e93b3f9e68d5a407961b0953befe8e160f3c39 100644 (file)
@@ -6,7 +6,6 @@ use wcf\system\cache\runtime\UserProfileRuntimeCache;
 use wcf\system\email\Email;
 use wcf\system\request\LinkHandler;
 use wcf\system\user\notification\object\CommentResponseUserNotificationObject;
-use wcf\system\WCF;
 
 /**
  * User notification event for profile's owner for comment responses.
@@ -29,7 +28,10 @@ class UserProfileCommentResponseOwnerUserNotificationEvent extends AbstractShare
         */
        protected function prepare() {
                CommentRuntimeCache::getInstance()->cacheObjectID($this->getUserNotificationObject()->commentID);
-               UserProfileRuntimeCache::getInstance()->cacheObjectID($this->additionalData['userID']);
+               UserProfileRuntimeCache::getInstance()->cacheObjectIDs([
+                       $this->additionalData['userID'],
+                       $this->additionalData['objectID']
+               ]);
        }
        
        /**
@@ -112,7 +114,11 @@ class UserProfileCommentResponseOwnerUserNotificationEvent extends AbstractShare
         * @inheritDoc
         */
        public function getLink() {
-               return LinkHandler::getInstance()->getLink('User', ['object' => WCF::getUser()], '#wall');
+               return LinkHandler::getInstance()->getLink(
+                       'User',
+                       ['object' => UserProfileRuntimeCache::getInstance()->getObject($this->additionalData['objectID'])],
+                       '#wall'
+               );
        }
        
        /**