2 namespace wcf\system\user\notification\event;
3 use wcf\system\cache\runtime\CommentRuntimeCache;
4 use wcf\system\cache\runtime\UserProfileRuntimeCache;
5 use wcf\system\email\Email;
6 use wcf\system\user\notification\object\CommentResponseUserNotificationObject;
9 * User notification event for profile comment responses.
11 * @author Alexander Ebert
12 * @copyright 2001-2016 WoltLab GmbH
13 * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
14 * @package WoltLabSuite\Core\System\User\Notification\Event
16 * @method CommentResponseUserNotificationObject getUserNotificationObject()
18 class UserProfileCommentResponseUserNotificationEvent extends AbstractSharedUserNotificationEvent {
22 protected $stackable = true;
27 protected function prepare() {
28 CommentRuntimeCache::getInstance()->cacheObjectID($this->getUserNotificationObject()->commentID);
29 UserProfileRuntimeCache::getInstance()->cacheObjectID($this->additionalData['objectID']);
35 public function getTitle() {
36 $count = count($this->getAuthors());
38 return $this->getLanguage()->getDynamicVariable('wcf.user.notification.commentResponse.title.stacked', [
40 'timesTriggered' => $this->notification->timesTriggered
44 return $this->getLanguage()->get('wcf.user.notification.commentResponse.title');
50 public function getMessage() {
51 $owner = UserProfileRuntimeCache::getInstance()->getObject($this->additionalData['objectID']);
53 $authors = $this->getAuthors();
54 if (count($authors) > 1) {
55 if (isset($authors[0])) {
58 $count = count($authors);
60 return $this->getLanguage()->getDynamicVariable('wcf.user.notification.commentResponse.message.stacked', [
61 'authors' => array_values($authors),
63 'others' => $count - 1,
65 'guestTimesTriggered' => $this->notification->guestTimesTriggered
69 return $this->getLanguage()->getDynamicVariable('wcf.user.notification.commentResponse.message', [
70 'author' => $this->author,
78 public function getEmailMessage($notificationType = 'instant') {
79 $comment = CommentRuntimeCache::getInstance()->getObject($this->getUserNotificationObject()->commentID);
80 $owner = UserProfileRuntimeCache::getInstance()->getObject($this->additionalData['objectID']);
82 $messageID = '<com.woltlab.wcf.user.profileComment.notification/'.$comment->commentID.'@'.Email::getHost().'>';
85 'template' => 'email_notification_userProfileCommentResponse',
86 'application' => 'wcf',
87 'in-reply-to' => [$messageID],
88 'references' => [$messageID],
98 public function getLink() {
99 return UserProfileRuntimeCache::getInstance()->getObject($this->additionalData['objectID'])->getLink() . '#wall';
105 public function getEventHash() {
106 return sha1($this->eventID . '-' . $this->getUserNotificationObject()->commentID);