From: Tim Düsterhus Date: Sat, 18 Jun 2016 13:48:03 +0000 (+0200) Subject: Use a fixed message-id in UserProfileCommentUserNotificationEvent X-Git-Tag: 3.0.0_Beta_1~916^2~1^2~9 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=27fb0b8cd3033eafc0bdf60f0b3b25504fe26a2b;p=GitHub%2FWoltLab%2FWCF.git Use a fixed message-id in UserProfileCommentUserNotificationEvent --- diff --git a/wcfsetup/install/files/lib/system/user/notification/UserNotificationHandler.class.php b/wcfsetup/install/files/lib/system/user/notification/UserNotificationHandler.class.php index 4682001aaa..28be7619b0 100644 --- a/wcfsetup/install/files/lib/system/user/notification/UserNotificationHandler.class.php +++ b/wcfsetup/install/files/lib/system/user/notification/UserNotificationHandler.class.php @@ -664,7 +664,6 @@ class UserNotificationHandler extends SingletonFactory { 'title' => $event->getEmailTitle() ])); $email->addRecipient(new UserMailbox($user)); - // TODO: MessageID, References, In-Reply-To $message = $event->getEmailMessage('instant'); if (is_array($message)) { @@ -676,6 +675,15 @@ class UserNotificationHandler extends SingletonFactory { if (isset($message['variables'])) { $variables['variables'] = $message['variables']; } + if (isset($message['message-id'])) { + $email->setMessageID($message['message-id']); + } + if (isset($message['in-reply-to'])) { + foreach ($message['in-reply-to'] as $inReplyTo) $email->addInReplyTo($inReplyTo); + } + if (isset($message['references'])) { + foreach ($message['references'] as $references) $email->addReferences($references); + } $html = new RecipientAwareTextMimePart('text/html', 'email_notification', 'wcf', $variables); $plainText = new RecipientAwareTextMimePart('text/plain', 'email_notification', 'wcf', $variables); diff --git a/wcfsetup/install/files/lib/system/user/notification/event/IUserNotificationEvent.class.php b/wcfsetup/install/files/lib/system/user/notification/event/IUserNotificationEvent.class.php index 3b7c975c09..e510b4327e 100644 --- a/wcfsetup/install/files/lib/system/user/notification/event/IUserNotificationEvent.class.php +++ b/wcfsetup/install/files/lib/system/user/notification/event/IUserNotificationEvent.class.php @@ -51,16 +51,25 @@ interface IUserNotificationEvent extends IDatabaseObjectProcessor { * * If $notificationType is 'instant' this method should either: * - Return a string to be inserted into a text/plain email (deprecated) - * - Return a ['template' => ..., 'application' => ..., 'variables' => ...] array - * to be included into the summary email. + * - Return an ['template' => ..., + * 'application' => ..., + * 'variables' => ..., + * 'message-id' => ..., + * 'in-reply-to' => [...], + * 'references' => [...]] + * array to be included into the notification email. + * message-id, in-reply-to and references refer to the respective headers + * of an email and are optional. You MUST NOT generate a message-id if you + * cannot ensure that it will *never* repeat. * * If $notificationType is 'daily' this method should either: * - Return a string to be inserted into the summary email (deprecated) - * - Return a ['template' => ..., 'application' => ..., 'variables' => ...] array + * - Return an ['template' => ..., 'application' => ..., 'variables' => ...] array * to be included into the summary email. * * @param string $notificationType * @return mixed + * @see \wcf\system\email\Email */ public function getEmailMessage($notificationType = 'instant'); diff --git a/wcfsetup/install/files/lib/system/user/notification/event/UserProfileCommentUserNotificationEvent.class.php b/wcfsetup/install/files/lib/system/user/notification/event/UserProfileCommentUserNotificationEvent.class.php index ad15f67d36..2e61a2bbb9 100644 --- a/wcfsetup/install/files/lib/system/user/notification/event/UserProfileCommentUserNotificationEvent.class.php +++ b/wcfsetup/install/files/lib/system/user/notification/event/UserProfileCommentUserNotificationEvent.class.php @@ -73,6 +73,7 @@ class UserProfileCommentUserNotificationEvent extends AbstractSharedUserNotifica */ public function getEmailMessage($notificationType = 'instant') { return [ + 'message-id' => 'com.woltlab.wcf.user.profileComment.notification/'.$this->getUserNotificationObject()->commentID, 'template' => 'email_notification_userProfileComment', 'application' => 'wcf', 'variables' => [