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-2017 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
,
71 'commentID' => $this->getUserNotificationObject()->commentID
,
73 'responseID' => $this->getUserNotificationObject()->responseID
80 public function getEmailMessage($notificationType = 'instant') {
81 $comment = CommentRuntimeCache
::getInstance()->getObject($this->getUserNotificationObject()->commentID
);
82 $owner = UserProfileRuntimeCache
::getInstance()->getObject($this->additionalData
['objectID']);
84 $messageID = '<com.woltlab.wcf.user.profileComment.notification/'.$comment->commentID
.'@'.Email
::getHost().'>';
87 'template' => 'email_notification_userProfileCommentResponse',
88 'application' => 'wcf',
89 'in-reply-to' => [$messageID],
90 'references' => [$messageID],
92 'commentID' => $this->getUserNotificationObject()->commentID
,
94 'responseID' => $this->getUserNotificationObject()->responseID
102 public function getLink() {
103 return UserProfileRuntimeCache
::getInstance()->getObject($this->additionalData
['objectID'])->getLink() . '#wall/comment' . $this->getUserNotificationObject()->commentID
. '/response' . $this->getUserNotificationObject()->responseID
;
109 public function getEventHash() {
110 return sha1($this->eventID
. '-' . $this->getUserNotificationObject()->commentID
);