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 * @method CommentResponseUserNotificationObject getUserNotificationObject()
20 class ArticleCommentResponseUserNotificationEvent extends AbstractCommentResponseUserNotificationEvent implements
21 ITestableUserNotificationEvent
23 use TTestableCommentResponseUserNotificationEvent;
24 use TTestableArticleCommentUserNotificationEvent;
29 protected function prepare()
31 CommentRuntimeCache::getInstance()->cacheObjectID($this->getUserNotificationObject()->commentID);
37 public function getMessage()
39 $authors = $this->getAuthors();
40 if (\count($authors) > 1) {
41 if (isset($authors[0])) {
44 $count = \count($authors);
46 return $this->getLanguage()->getDynamicVariable(
47 'wcf.user.notification.articleComment.response.message.stacked',
49 'author' => $this->author,
50 'authors' => \array_values($authors),
51 'commentID' => $this->getUserNotificationObject()->commentID,
52 'article' => ViewableArticleContentRuntimeCache::getInstance()
53 ->getObject($this->additionalData['objectID']),
55 'others' => $count - 1,
56 'guestTimesTriggered' => $this->notification->guestTimesTriggered,
57 'responseID' => $this->getUserNotificationObject()->responseID,
62 return $this->getLanguage()->getDynamicVariable('wcf.user.notification.articleComment.response.message', [
63 'author' => $this->author,
64 'commentID' => $this->getUserNotificationObject()->commentID,
65 'article' => ViewableArticleContentRuntimeCache::getInstance()
66 ->getObject($this->additionalData['objectID']),
67 'responseID' => $this->getUserNotificationObject()->responseID,
74 public function getEmailMessage($notificationType = 'instant')
76 $messageID = '<com.woltlab.wcf.user.articleComment.notification/' . $this->getUserNotificationObject()->commentID . '@' . Email::getHost() . '>';
79 'template' => 'email_notification_commentResponse',
80 'in-reply-to' => [$messageID],
81 'references' => [$messageID],
82 'application' => 'wcf',
84 'commentID' => $this->getUserNotificationObject()->commentID,
85 'article' => ViewableArticleContentRuntimeCache::getInstance()
86 ->getObject($this->additionalData['objectID']),
87 'languageVariablePrefix' => 'wcf.user.notification.articleComment.response',
88 'responseID' => $this->getUserNotificationObject()->responseID,
96 public function getLink(): string
98 return ViewableArticleContentRuntimeCache::getInstance()->getObject($this->additionalData['objectID'])->getLink() . '#comment' . $this->getUserNotificationObject()->commentID . '/response' . $this->getUserNotificationObject()->responseID;
104 protected function getTypeName(): string
106 return $this->getLanguage()->get('wcf.user.recentActivity.com.woltlab.wcf.article.recentActivityEvent');
112 protected function getObjectTitle(): string
114 return ViewableArticleContentRuntimeCache::getInstance()
115 ->getObject($this->additionalData['objectID'])->getTitle();