<?php
namespace wcf\system\user\notification\event;
-use wcf\data\user\User;
+use wcf\system\cache\runtime\UserProfileRuntimeCache;
use wcf\system\request\LinkHandler;
/**
- * User notification event for profile commments.
+ * User notification event for profile comments.
*
* @author Alexander Ebert
- * @copyright 2001-2015 WoltLab GmbH
+ * @copyright 2001-2016 WoltLab GmbH
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
* @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();
}
$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(
}
/**
- * @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) {
}
$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,
'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);