3 namespace wcf\system\user\notification\event;
5 use wcf\system\cache\runtime\CommentRuntimeCache;
6 use wcf\system\cache\runtime\ViewableArticleContentRuntimeCache;
7 use wcf\system\email\Email;
8 use wcf\system\user\notification\object\CommentResponseUserNotificationObject;
11 * User notification event for article comment responses.
13 * @author Joshua Ruesweg
14 * @copyright 2001-2019 WoltLab GmbH
15 * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
18 class ArticleCommentResponseUserNotificationEvent extends AbstractCommentResponseUserNotificationEvent implements
19 ITestableUserNotificationEvent
21 use TTestableCommentResponseUserNotificationEvent;
22 use TTestableArticleCommentUserNotificationEvent;
27 public function getMessage()
29 $authors = $this->getAuthors();
30 if (\count($authors) > 1) {
31 if (isset($authors[0])) {
34 $count = \count($authors);
36 return $this->getLanguage()->getDynamicVariable(
37 'wcf.user.notification.articleComment.response.message.stacked',
39 'author' => $this->author,
40 'authors' => \array_values($authors),
41 'commentID' => $this->getUserNotificationObject()->commentID,
42 'article' => ViewableArticleContentRuntimeCache::getInstance()
43 ->getObject($this->additionalData['objectID']),
45 'others' => $count - 1,
46 'guestTimesTriggered' => $this->notification->guestTimesTriggered,
47 'responseID' => $this->getUserNotificationObject()->responseID,
52 return $this->getLanguage()->getDynamicVariable('wcf.user.notification.articleComment.response.message', [
53 'author' => $this->author,
54 'commentID' => $this->getUserNotificationObject()->commentID,
55 'article' => ViewableArticleContentRuntimeCache::getInstance()
56 ->getObject($this->additionalData['objectID']),
57 'responseID' => $this->getUserNotificationObject()->responseID,
64 public function getEmailMessage($notificationType = 'instant')
66 $messageID = '<com.woltlab.wcf.user.articleComment.notification/' . $this->getUserNotificationObject()->commentID . '@' . Email::getHost() . '>';
69 'template' => 'email_notification_commentResponse',
70 'in-reply-to' => [$messageID],
71 'references' => [$messageID],
72 'application' => 'wcf',
74 'commentID' => $this->getUserNotificationObject()->commentID,
75 'article' => ViewableArticleContentRuntimeCache::getInstance()
76 ->getObject($this->additionalData['objectID']),
77 'languageVariablePrefix' => 'wcf.user.notification.articleComment.response',
78 'responseID' => $this->getUserNotificationObject()->responseID,
86 public function getLink(): string
88 return ViewableArticleContentRuntimeCache::getInstance()->getObject($this->additionalData['objectID'])->getLink() . '#comment' . $this->getUserNotificationObject()->commentID . '/response' . $this->getUserNotificationObject()->responseID;
94 protected function getTypeName(): string
96 return $this->getLanguage()->get('wcf.user.recentActivity.com.woltlab.wcf.article.recentActivityEvent');
102 protected function getObjectTitle(): string
104 return ViewableArticleContentRuntimeCache::getInstance()
105 ->getObject($this->additionalData['objectID'])->getTitle();