2 namespace wcf\system\user\notification\event;
3 use wcf\system\cache\runtime\UserProfileRuntimeCache;
4 use wcf\system\request\LinkHandler;
8 * User notification event for profile comment response likes.
10 * @author Alexander Ebert
11 * @copyright 2001-2016 WoltLab GmbH
12 * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
13 * @package WoltLabSuite\Core\System\User\Notification\Event
15 class UserProfileCommentResponseLikeUserNotificationEvent extends AbstractSharedUserNotificationEvent {
19 protected $stackable = true;
24 protected function prepare() {
25 UserProfileRuntimeCache::getInstance()->cacheObjectID($this->additionalData['objectID']);
26 UserProfileRuntimeCache::getInstance()->cacheObjectID($this->additionalData['commentUserID']);
32 public function getTitle() {
33 $count = count($this->getAuthors());
35 return $this->getLanguage()->getDynamicVariable('wcf.user.notification.commentResponse.like.title.stacked', [
37 'timesTriggered' => $this->notification->timesTriggered
41 return $this->getLanguage()->get('wcf.user.notification.commentResponse.like.title');
47 public function getMessage() {
48 $authors = array_values($this->getAuthors());
49 $count = count($authors);
50 $commentUser = $owner = null;
51 if ($this->additionalData['objectID'] != WCF::getUser()->userID) {
52 $owner = UserProfileRuntimeCache::getInstance()->getObject($this->additionalData['objectID']);
54 if ($this->additionalData['commentUserID'] != WCF::getUser()->userID) {
55 $commentUser = UserProfileRuntimeCache::getInstance()->getObject($this->additionalData['commentUserID']);
59 return $this->getLanguage()->getDynamicVariable('wcf.user.notification.commentResponse.like.message.stacked', [
60 'author' => $this->author,
61 'authors' => $authors,
62 'commentUser' => $commentUser,
64 'others' => $count - 1,
69 return $this->getLanguage()->getDynamicVariable('wcf.user.notification.commentResponse.like.message', [
70 'author' => $this->author,
78 public function getEmailMessage($notificationType = 'instant') {
79 throw new \LogicException('Unreachable');
85 public function getLink() {
86 $owner = WCF::getUser();
87 if ($this->additionalData['objectID'] != WCF::getUser()->userID) {
88 $owner = UserProfileRuntimeCache::getInstance()->getObject($this->additionalData['objectID']);
91 return LinkHandler::getInstance()->getLink('User', ['object' => $owner], '#wall');
97 public function getEventHash() {
98 return sha1($this->eventID . '-' . $this->additionalData['commentID']);
104 public function supportsEmailNotification() {