3 namespace wcf\system\user\notification\event;
5 use wcf\system\cache\runtime\ViewableArticleContentRuntimeCache;
6 use wcf\system\user\notification\object\CommentUserNotificationObject;
9 * User notification event for article comments.
11 * @author Joshua Ruesweg
12 * @copyright 2001-2019 WoltLab GmbH
13 * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
16 * @method CommentUserNotificationObject getUserNotificationObject()
18 class ArticleCommentUserNotificationEvent extends AbstractSharedUserNotificationEvent implements
19 ITestableUserNotificationEvent
21 use TTestableCommentUserNotificationEvent;
22 use TTestableArticleCommentUserNotificationEvent;
27 protected $stackable = true;
32 protected function prepare()
34 ViewableArticleContentRuntimeCache::getInstance()->cacheObjectID($this->getUserNotificationObject()->objectID);
40 public function getTitle(): string
42 $count = \count($this->getAuthors());
44 return $this->getLanguage()->getDynamicVariable('wcf.user.notification.articleComment.title.stacked', [
46 'timesTriggered' => $this->notification->timesTriggered,
50 return $this->getLanguage()->getDynamicVariable('wcf.user.notification.articleComment.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.articleComment.message.stacked', [
66 'author' => $this->author,
67 'authors' => \array_values($authors),
68 'commentID' => $this->getUserNotificationObject()->commentID,
69 'article' => ViewableArticleContentRuntimeCache::getInstance()
70 ->getObject($this->getUserNotificationObject()->objectID),
72 'others' => $count - 1,
73 'guestTimesTriggered' => $this->notification->guestTimesTriggered,
77 return $this->getLanguage()->getDynamicVariable('wcf.user.notification.articleComment.message', [
78 'author' => $this->author,
79 'commentID' => $this->getUserNotificationObject()->commentID,
80 'article' => ViewableArticleContentRuntimeCache::getInstance()
81 ->getObject($this->getUserNotificationObject()->objectID),
88 public function getEmailMessage($notificationType = 'instant')
91 'message-id' => 'com.woltlab.wcf.user.articleComment.notification/' . $this->getUserNotificationObject()->commentID,
92 'template' => 'email_notification_comment',
93 'application' => 'wcf',
95 'commentID' => $this->getUserNotificationObject()->commentID,
96 'article' => ViewableArticleContentRuntimeCache::getInstance()
97 ->getObject($this->getUserNotificationObject()->objectID),
98 'languageVariablePrefix' => 'wcf.user.notification.articleComment',
106 public function getLink(): string
108 return ViewableArticleContentRuntimeCache::getInstance()->getObject($this->getUserNotificationObject()->objectID)->getLink() . '#comment' . $this->getUserNotificationObject()->commentID;
114 public function getEventHash()
116 return \sha1($this->eventID . '-' . $this->getUserNotificationObject()->objectID);