3 namespace wcf\system\user\notification\event;
5 use wcf\data\user\UserProfile;
6 use wcf\system\cache\runtime\UserProfileRuntimeCache;
7 use wcf\system\comment\CommentHandler;
8 use wcf\system\user\notification\object\CommentUserNotificationObject;
11 * User notification event for profile comments.
13 * @author Alexander Ebert
14 * @copyright 2001-2019 WoltLab GmbH
15 * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
17 * @method CommentUserNotificationObject getUserNotificationObject()
19 class UserProfileCommentUserNotificationEvent extends AbstractSharedUserNotificationEvent implements
20 ITestableUserNotificationEvent
22 use TTestableCommentUserNotificationEvent;
27 protected $stackable = true;
32 protected function prepare()
34 UserProfileRuntimeCache::getInstance()->cacheObjectID($this->getUserNotificationObject()->objectID);
40 public function getTitle(): string
42 $count = \count($this->getAuthors());
44 return $this->getLanguage()->getDynamicVariable('wcf.user.notification.comment.title.stacked', [
46 'timesTriggered' => $this->notification->timesTriggered,
50 return $this->getLanguage()->get('wcf.user.notification.comment.title');
56 public function getMessage()
58 $authors = $this->getAuthors();
59 if (\count($authors) > 1) {
60 if (isset($authors[0])) {
63 $count = \count($authors);
65 return $this->getLanguage()->getDynamicVariable('wcf.user.notification.comment.message.stacked', [
66 'author' => $this->author,
67 'authors' => \array_values($authors),
68 'commentID' => $this->getUserNotificationObject()->commentID,
70 'others' => $count - 1,
71 'guestTimesTriggered' => $this->notification->guestTimesTriggered,
75 return $this->getLanguage()->getDynamicVariable('wcf.user.notification.comment.message', [
76 'author' => $this->author,
77 'commentID' => $this->getUserNotificationObject()->commentID,
84 public function getEmailMessage($notificationType = 'instant')
87 'message-id' => 'com.woltlab.wcf.user.profileComment.notification/' . $this->getUserNotificationObject()->commentID,
88 'template' => 'email_notification_comment',
89 'application' => 'wcf',
91 'commentID' => $this->getUserNotificationObject()->commentID,
92 'owner' => UserProfileRuntimeCache::getInstance()
93 ->getObject($this->getUserNotificationObject()->objectID),
94 'languageVariablePrefix' => 'wcf.user.notification.comment',
102 public function getLink(): string
104 return UserProfileRuntimeCache::getInstance()->getObject($this->getUserNotificationObject()->objectID)->getLink()
105 . '#wall/comment' . $this->getUserNotificationObject()->commentID;
111 public function getEventHash()
113 return \sha1($this->eventID . '-' . $this->notification->userID);
120 protected static function getTestCommentObjectData(UserProfile $recipient, UserProfile $author)
123 'objectID' => $recipient->userID,
124 'objectTypeID' => CommentHandler::getInstance()->getObjectTypeID('com.woltlab.wcf.user.profileComment'),