3 namespace wcf\system\user\notification\event
;
5 use wcf\data\user\UserProfile
;
6 use wcf\system\email\Email
;
7 use wcf\system\user\notification\
object\ConversationMessageUserNotificationObject
;
10 * User notification event for conversation messages.
13 * @copyright 2001-2019 WoltLab GmbH
14 * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
15 * @package WoltLabSuite\Core\System\User\Notification\Event
17 * @method ConversationMessageUserNotificationObject getUserNotificationObject()
19 class ConversationMessageUserNotificationEvent
extends AbstractUserNotificationEvent
implements
20 ITestableUserNotificationEvent
22 use TTestableConversationRelatedUserNotificationEvent
;
23 use TTestableUserNotificationEvent
;
28 protected $stackable = true;
33 public function getTitle()
35 $count = \
count($this->getAuthors());
37 return $this->getLanguage()->getDynamicVariable(
38 'wcf.user.notification.conversation.message.title.stacked',
43 return $this->getLanguage()->get('wcf.user.notification.conversation.message.title');
49 public function getMessage()
51 $authors = \array_values
($this->getAuthors());
52 $count = \
count($authors);
55 return $this->getLanguage()->getDynamicVariable(
56 'wcf.user.notification.conversation.message.message.stacked',
58 'author' => $this->author
,
59 'authors' => $authors,
61 'message' => $this->userNotificationObject
,
62 'others' => $count - 1,
67 return $this->getLanguage()->getDynamicVariable('wcf.user.notification.conversation.message.message', [
68 'author' => $this->author
,
69 'message' => $this->userNotificationObject
,
76 public function getEmailMessage($notificationType = 'instant')
78 $messageID = '<com.woltlab.wcf.conversation.notification/' . $this->getUserNotificationObject()->getConversation()->conversationID
. '@' . Email
::getHost() . '>';
81 'template' => 'email_notification_conversationMessage',
82 'application' => 'wcf',
83 'in-reply-to' => [$messageID],
84 'references' => [$messageID],
86 'author' => $this->author
,
87 'message' => $this->userNotificationObject
,
88 'conversation' => $this->userNotificationObject
->getConversation(),
97 public function getEmailTitle()
99 if (\
count($this->getAuthors()) > 1) {
100 return parent
::getEmailTitle();
103 return $this->getLanguage()->getDynamicVariable('wcf.user.notification.conversation.message.mail.title', [
104 'author' => $this->author
,
105 'message' => $this->userNotificationObject
,
106 'conversation' => $this->userNotificationObject
->getConversation(),
113 public function getLink()
115 return $this->getUserNotificationObject()->getLink();
121 public function getEventHash()
123 return \
sha1($this->eventID
. '-' . $this->getUserNotificationObject()->conversationID
);
129 public function checkAccess()
131 return $this->getUserNotificationObject()->getConversation()->canRead();
137 public static function getTestObjects(UserProfile
$recipient, UserProfile
$author)
140 new ConversationMessageUserNotificationObject(self
::createTestConversationMessage($recipient, $author)),