From ffd86462f363f6de3d22770bba9df096cfa0019b Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim=20D=C3=BCsterhus?= Date: Mon, 1 Aug 2016 16:40:18 +0200 Subject: [PATCH] Convert conversation message notification to new email API --- ...tionMessageUserNotificationEvent.class.php | 14 ++++--- language/de.xml | 8 +--- language/en.xml | 8 +--- ...email_notification_conversationMessage.tpl | 40 +++++++++++++++++++ 4 files changed, 53 insertions(+), 17 deletions(-) create mode 100644 templates/email_notification_conversationMessage.tpl diff --git a/files/lib/system/user/notification/event/ConversationMessageUserNotificationEvent.class.php b/files/lib/system/user/notification/event/ConversationMessageUserNotificationEvent.class.php index ac1e48b..c9b7120 100644 --- a/files/lib/system/user/notification/event/ConversationMessageUserNotificationEvent.class.php +++ b/files/lib/system/user/notification/event/ConversationMessageUserNotificationEvent.class.php @@ -1,5 +1,6 @@ getLanguage()->getDynamicVariable('wcf.user.notification.conversation.message.mail', [ - 'message' => $this->userNotificationObject, - 'author' => $this->author, - 'notificationType' => $notificationType - ]); + $messageID = 'getUserNotificationObject()->getConversation()->conversationID.'@'.Email::getHost().'>'; + + return [ + 'template' => 'email_notification_conversationMessage', + 'application' => 'wcf', + 'in-reply-to' => [$messageID], + 'references' => [$messageID] + ]; } /** diff --git a/language/de.xml b/language/de.xml index 8919d72..9f2a7ea 100644 --- a/language/de.xml +++ b/language/de.xml @@ -183,12 +183,8 @@ getAnchorTag()}{if $count == 2} und {else}, {/if}{@$authors[1]->getAnchorTag()}{if $count == 3} und {@$authors[2]->getAnchorTag()}{/if}{else}{@$authors[0]->getAnchorTag()} und {#$count} weitere{/if} haben auf die Konversation {$message->getConversation()->getTitle()} geantwortet.]]> - username} hat auf die Konversation "{@$message->getTitle()}" geantwortet: -{if $notificationType == 'instant'} ---------------------------------- -{@$message->getMailText()} ---------------------------------- -{/if}{link controller='Conversation' object=$message->getConversation() isEmail=true}messageID={@$message->messageID}{/link}#message{@$message->messageID}]]> + getUserNotificationObject()->getConversation()->subject}“ [URL:{link controller='Conversation' object=$event->getUserNotificationObject()->getConversation() isEmail=true}{/link}] geantwortet{if $count == 1 && !$guestTimesTriggered}:{else}.{/if}]]> + {@$authorList} {if $count == 1 && !$guestTimesTriggered}hat{else}haben{/if} auf die Konversation {$event->getUserNotificationObject()->getConversation()->subject} geantwortet:

]]>
getAnchorTag()} hat die Konversation {$conversation->subject} gestartet.]]> getAuthor()->username} [URL:{link controller='User' object=$event->getAuthor() isEmail=true}{/link}] hat die Konversation „{@$event->getUserNotificationObject()->subject}“ [URL:{link controller='Conversation' object=$event->getUserNotificationObject() isEmail=true}{/link}] gestartet:]]> diff --git a/language/en.xml b/language/en.xml index 04a0a7c..eca96d2 100644 --- a/language/en.xml +++ b/language/en.xml @@ -192,14 +192,10 @@ {@$message->getMailText()} --------------------------------- {/if}{link controller='Conversation' object=$message->getConversation() isEmail=true}messageID={@$message->messageID}{/link}#message{@$message->messageID}]]> + getUserNotificationObject()->getConversation()->subject}” [URL:{link controller='Conversation' object=$event->getUserNotificationObject()->getConversation() isEmail=true}{/link}]{if $count == 1 && !$guestTimesTriggered}:{else}.{/if}]]> + {@$authorList} replied to the conversation {$event->getUserNotificationObject()->getConversation()->subject}:

]]>
getAnchorTag()} started the conversation {$conversation->subject}.]]> - username} started the conversation "{@$conversation->subject}": -{if $notificationType == 'instant'} ---------------------------------- -{@$conversation->getFirstMessage()->getMailText()} ---------------------------------- -{/if}{link controller='Conversation' object=$conversation isEmail=true}{/link}]]> getAuthor()->username} [URL:{link controller='User' object=$event->getAuthor() isEmail=true}{/link}] started the conversation “{@$event->getUserNotificationObject()->subject}” [URL:{link controller='Conversation' object=$event->getUserNotificationObject() isEmail=true}{/link}]:]]> {$event->getAuthor()->username} started the conversation {$event->getUserNotificationObject()->subject}:

]]>
diff --git a/templates/email_notification_conversationMessage.tpl b/templates/email_notification_conversationMessage.tpl new file mode 100644 index 0000000..41cf23c --- /dev/null +++ b/templates/email_notification_conversationMessage.tpl @@ -0,0 +1,40 @@ +{assign var='count' value=$event->getAuthors()|count}{assign var='guestTimesTriggered' value=$event->getNotification()->guestTimesTriggered}{assign var='authors' value=$event->getAuthors()|array_values} +{if $mimeType === 'text/plain'} +{capture assign='authorList'}{lang}wcf.user.notification.mail.authorList.plaintext{/lang}{/capture} +{lang}wcf.user.notification.conversation.message.mail.plaintext{/lang}{if $count == 1 && !$guestTimesTriggered} + +{@$event->getUserNotificationObject()->getMailText($mimeType)}{/if} {* this line ends with a space *} +{else} + {capture assign='authorList'}{lang}wcf.user.notification.mail.authorList.html{/lang}{/capture} + {lang}wcf.user.notification.conversation.message.mail.html{/lang} + {assign var='user' value=$event->getAuthor()} + {assign var='message' value=$event->getUserNotificationObject()} + {assign var='conversation' value=$message->getConversation()} + + {if $notificationType == 'instant'}{assign var='avatarSize' value=128} + {else}{assign var='avatarSize' value=64}{/if} + {capture assign='messageContent'} + + + + + +
{@$user->getAvatar()->getImageTag($avatarSize)} +
+

+ {if $message->userID} + {$message->username} + {else} + {$message->username} + {/if} + · + {$message->time|plainTime} +

+
+
+ {@$message->getMailText($mimeType)} +
+
+ {/capture} + {include file='email_paddingHelper' block=true class='box'|concat:$avatarSize content=$messageContent sandbox=true} +{/if} -- 2.20.1