3 namespace wcf\system\user\notification\event;
5 use wcf\system\cache\runtime\ViewableArticleContentRuntimeCache;
6 use wcf\system\user\notification\event\AbstractSharedUserNotificationEvent;
7 use wcf\system\user\notification\event\ITestableUserNotificationEvent;
8 use wcf\system\user\notification\event\TReactionUserNotificationEvent;
9 use wcf\system\user\notification\event\TTestableCommentLikeUserNotificationEvent;
10 use wcf\system\user\notification\object\LikeUserNotificationObject;
13 * User notification event for article comment likes.
16 * @copyright 2001-2022 WoltLab GmbH
17 * @license WoltLab License <http://www.woltlab.com/license-agreement.html>
18 * @package WoltLabSuite\Core\System\User\Notification\Event
21 * @method LikeUserNotificationObject getUserNotificationObject()
23 class ArticleCommentLikeUserNotificationEvent extends AbstractSharedUserNotificationEvent implements
24 ITestableUserNotificationEvent
26 use TTestableCommentLikeUserNotificationEvent;
27 use TTestableArticleCommentUserNotificationEvent;
28 use TReactionUserNotificationEvent;
33 protected $stackable = true;
38 protected function prepare()
40 ViewableArticleContentRuntimeCache::getInstance()->cacheObjectID($this->additionalData['objectID']);
46 public function getTitle()
48 $count = \count($this->getAuthors());
50 return $this->getLanguage()->getDynamicVariable('wcf.user.notification.articleComment.like.title.stacked', [
52 'timesTriggered' => $this->notification->timesTriggered,
56 return $this->getLanguage()->get('wcf.user.notification.articleComment.like.title');
62 public function getMessage()
64 $article = ViewableArticleContentRuntimeCache::getInstance()->getObject($this->additionalData['objectID']);
65 $authors = \array_values($this->getAuthors());
66 $count = \count($authors);
69 return $this->getLanguage()->getDynamicVariable('wcf.user.notification.articleComment.like.message.stacked', [
70 'author' => $this->author,
71 'authors' => $authors,
72 'commentID' => $this->getCommentID(),
74 'others' => $count - 1,
75 'article' => $article,
76 'reactions' => $this->getReactionsForAuthors(),
80 return $this->getLanguage()->getDynamicVariable('wcf.user.notification.articleComment.like.message', [
81 'author' => $this->author,
82 'commentID' => $this->getCommentID(),
83 'article' => $article,
84 'reactions' => $this->getReactionsForAuthors(),
91 public function getEmailMessage($notificationType = 'instant')
99 public function getLink()
101 return ViewableArticleContentRuntimeCache::getInstance()->getObject($this->additionalData['objectID'])->getLink() . '#comment' . $this->getCommentID();
107 public function getEventHash()
109 return \sha1($this->eventID . '-' . $this->getCommentID());
115 public function supportsEmailNotification()
121 * Returns the liked comment's id.
125 protected function getCommentID()
127 // this is the `wcfN_like.objectID` value
128 return $this->getUserNotificationObject()->objectID;