From: Fabii Date: Thu, 31 Mar 2016 14:36:25 +0000 (+0200) Subject: Use UserProfileRuntimeCache in UserProfileCommentUserNotificationEvent X-Git-Tag: 3.0.0_Beta_1~1288^2 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=fa1ddb3342ae38ae0aae6814f91574be7387b2d0;p=GitHub%2FWoltLab%2FWCF.git Use UserProfileRuntimeCache in UserProfileCommentUserNotificationEvent --- diff --git a/wcfsetup/install/files/lib/system/user/notification/event/UserProfileCommentUserNotificationEvent.class.php b/wcfsetup/install/files/lib/system/user/notification/event/UserProfileCommentUserNotificationEvent.class.php index 76c5646e55..3c8edbb4ed 100644 --- a/wcfsetup/install/files/lib/system/user/notification/event/UserProfileCommentUserNotificationEvent.class.php +++ b/wcfsetup/install/files/lib/system/user/notification/event/UserProfileCommentUserNotificationEvent.class.php @@ -1,41 +1,48 @@ * @package com.woltlab.wcf * @subpackage system.user.notification.event * @category Community Framework */ -class UserProfileCommentUserNotificationEvent extends AbstractUserNotificationEvent { +class UserProfileCommentUserNotificationEvent extends AbstractSharedUserNotificationEvent { /** - * @see \wcf\system\user\notification\event\AbstractUserNotificationEvent::$stackable + * @inheritDoc */ protected $stackable = true; + + /** + * @inheritDoc + */ + protected function prepare() { + UserProfileRuntimeCache::getInstance()->cacheObjectID($this->userNotificationObject->objectID); + } /** - * @see \wcf\system\user\notification\event\IUserNotificationEvent::getTitle() + * @inheritDoc */ public function getTitle() { $count = count($this->getAuthors()); if ($count > 1) { - return $this->getLanguage()->getDynamicVariable('wcf.user.notification.comment.title.stacked', array( + return $this->getLanguage()->getDynamicVariable('wcf.user.notification.comment.title.stacked', [ 'count' => $count, 'timesTriggered' => $this->notification->timesTriggered - )); + ]); } return $this->getLanguage()->get('wcf.user.notification.comment.title'); } /** - * @see \wcf\system\user\notification\event\IUserNotificationEvent::getMessage() + * @inheritDoc */ public function getMessage() { $authors = $this->getAuthors(); @@ -45,13 +52,13 @@ class UserProfileCommentUserNotificationEvent extends AbstractUserNotificationEv } $count = count($authors); - return $this->getLanguage()->getDynamicVariable('wcf.user.notification.comment.message.stacked', array( + return $this->getLanguage()->getDynamicVariable('wcf.user.notification.comment.message.stacked', [ 'author' => $this->author, 'authors' => array_values($authors), 'count' => $count, 'others' => $count - 1, 'guestTimesTriggered' => $this->notification->guestTimesTriggered - )); + ]); } return $this->getLanguage()->getDynamicVariable('wcf.user.notification.comment.message', array( @@ -60,10 +67,10 @@ class UserProfileCommentUserNotificationEvent extends AbstractUserNotificationEv } /** - * @see \wcf\system\user\notification\event\IUserNotificationEvent::getEmailMessage() + * @inheritDoc */ public function getEmailMessage($notificationType = 'instant') { - $user = new User($this->userNotificationObject->objectID); + $user = UserProfileRuntimeCache::getInstance()->getObject($this->userNotificationObject->objectID); $authors = $this->getAuthors(); if (count($authors) > 1) { @@ -72,7 +79,7 @@ class UserProfileCommentUserNotificationEvent extends AbstractUserNotificationEv } $count = count($authors); - return $this->getLanguage()->getDynamicVariable('wcf.user.notification.comment.mail.stacked', array( + return $this->getLanguage()->getDynamicVariable('wcf.user.notification.comment.mail.stacked', [ 'author' => $this->author, 'authors' => array_values($authors), 'count' => $count, @@ -80,26 +87,28 @@ class UserProfileCommentUserNotificationEvent extends AbstractUserNotificationEv 'owner' => $user, 'notificationType' => $notificationType, 'guestTimesTriggered' => $this->notification->guestTimesTriggered - )); + ]); } - return $this->getLanguage()->getDynamicVariable('wcf.user.notification.comment.mail', array( + return $this->getLanguage()->getDynamicVariable('wcf.user.notification.comment.mail', [ 'comment' => $this->userNotificationObject, 'author' => $this->author, 'owner' => $user, 'notificationType' => $notificationType - )); + ]); } /** - * @see \wcf\system\user\notification\event\IUserNotificationEvent::getLink() + * @inheritDoc */ public function getLink() { - return LinkHandler::getInstance()->getLink('User', array('id' => $this->userNotificationObject->objectID), '#wall'); + $user = UserProfileRuntimeCache::getInstance()->getObject($this->userNotificationObject->objectID); + + return LinkHandler::getInstance()->getLink('User', ['object' => $user], '#wall'); } /** - * @see \wcf\system\user\notification\event\IUserNotificationEvent::getEventHash() + * @inheritDoc */ public function getEventHash() { return sha1($this->eventID . '-' . $this->notification->userID);