3 namespace wcf\system\user\notification\event;
5 use wcf\system\cache\runtime\UserRuntimeCache;
6 use wcf\system\cache\runtime\ViewableArticleContentRuntimeCache;
7 use wcf\system\user\notification\event\AbstractSharedUserNotificationEvent;
8 use wcf\system\user\notification\event\ITestableUserNotificationEvent;
9 use wcf\system\user\notification\event\TReactionUserNotificationEvent;
10 use wcf\system\user\notification\event\TTestableCommentResponseLikeUserNotificationEvent;
11 use wcf\system\user\notification\object\LikeUserNotificationObject;
15 * User notification event for article comment response likes.
18 * @copyright 2001-2022 WoltLab GmbH
19 * @license WoltLab License <http://www.woltlab.com/license-agreement.html>
20 * @package WoltLabSuite\Core\System\User\Notification\Event
23 * @method LikeUserNotificationObject getUserNotificationObject()
25 class ArticleCommentResponseLikeUserNotificationEvent extends AbstractSharedUserNotificationEvent implements
26 ITestableUserNotificationEvent
28 use TTestableCommentResponseLikeUserNotificationEvent;
29 use TTestableArticleCommentUserNotificationEvent;
30 use TReactionUserNotificationEvent;
35 protected $stackable = true;
40 protected function prepare()
42 ViewableArticleContentRuntimeCache::getInstance()->cacheObjectID($this->additionalData['objectID']);
43 UserRuntimeCache::getInstance()->cacheObjectID($this->additionalData['commentUserID']);
49 public function getTitle()
51 $count = \count($this->getAuthors());
53 return $this->getLanguage()->getDynamicVariable(
54 'wcf.user.notification.articleComment.response.like.title.stacked',
57 'timesTriggered' => $this->notification->timesTriggered,
62 return $this->getLanguage()->get('wcf.user.notification.articleComment.response.like.title');
68 public function getMessage()
70 $article = ViewableArticleContentRuntimeCache::getInstance()->getObject($this->additionalData['objectID']);
71 $authors = \array_values($this->getAuthors());
72 $count = \count($authors);
74 if ($this->additionalData['commentUserID'] != WCF::getUser()->userID) {
75 $commentUser = UserRuntimeCache::getInstance()->getObject($this->additionalData['commentUserID']);
79 return $this->getLanguage()->getDynamicVariable(
80 'wcf.user.notification.articleComment.response.like.message.stacked',
82 'author' => $this->author,
83 'authors' => $authors,
84 'commentID' => $this->additionalData['commentID'],
85 'commentUser' => $commentUser,
87 'others' => $count - 1,
88 'article' => $article,
89 'responseID' => $this->getUserNotificationObject()->objectID,
90 'reactions' => $this->getReactionsForAuthors(),
95 return $this->getLanguage()->getDynamicVariable('wcf.user.notification.articleComment.response.like.message', [
96 'author' => $this->author,
97 'commentID' => $this->additionalData['commentID'],
98 'article' => $article,
99 'responseID' => $this->getUserNotificationObject()->objectID,
100 'reactions' => $this->getReactionsForAuthors(),
107 public function getEmailMessage($notificationType = 'instant')
115 public function getLink()
117 return ViewableArticleContentRuntimeCache::getInstance()->getObject($this->additionalData['objectID'])->getLink()
118 . '#comment' . $this->additionalData['commentID'] . '/response' . $this->getUserNotificationObject()->objectID;
124 public function getEventHash()
126 return \sha1($this->eventID . '-' . $this->getUserNotificationObject()->objectID);
132 public function supportsEmailNotification()