From 852a7f7fd03a8841a09ca0f4f43ea78cea80917f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim=20D=C3=BCsterhus?= Date: Fri, 17 Jun 2016 20:36:13 +0200 Subject: [PATCH] Convert email notifications for wall comments to new API --- com.woltlab.wcf/templates/email_html.tpl | 9 +++++ ...email_notification_userFollowFollowing.tpl | 7 ++-- .../email_notification_userProfileComment.tpl | 32 +++++++++++++++++ ...fileCommentUserNotificationEvent.class.php | 34 +++++-------------- wcfsetup/install/lang/de.xml | 12 ++----- wcfsetup/install/lang/en.xml | 12 ++----- 6 files changed, 58 insertions(+), 48 deletions(-) create mode 100644 com.woltlab.wcf/templates/email_notification_userProfileComment.tpl diff --git a/com.woltlab.wcf/templates/email_html.tpl b/com.woltlab.wcf/templates/email_html.tpl index 030e52da6a..74027982b4 100644 --- a/com.woltlab.wcf/templates/email_html.tpl +++ b/com.woltlab.wcf/templates/email_html.tpl @@ -42,6 +42,10 @@ font-size: {$style->getVariable('wcfFontSizeTitle')}; color: {$style->getVariable('wcfContentHeadlineText')}; } + small { + font-size: {$style->getVariable('wcfFontSizeSmall')}; + font-weight: 300; + } {* Buttons *} td.button { @@ -59,9 +63,14 @@ padding: 20px; } + .box128 td.boxContent { + padding-left: 20px; + } + .containerHeadline h3 { margin: 0; padding: 0; + font-weight: 400; } diff --git a/com.woltlab.wcf/templates/email_notification_userFollowFollowing.tpl b/com.woltlab.wcf/templates/email_notification_userFollowFollowing.tpl index 7618d204bc..474603f6d4 100644 --- a/com.woltlab.wcf/templates/email_notification_userFollowFollowing.tpl +++ b/com.woltlab.wcf/templates/email_notification_userFollowFollowing.tpl @@ -1,18 +1,17 @@ {if $mimeType === 'text/plain'} {lang}wcf.user.notification.follow.mail.plaintext{/lang} {else} + {lang}wcf.user.notification.follow.mail.html{/lang} {assign var='user' value=$event->getAuthor()} {capture assign='userContent'} - - +
{@$user->getAvatar()->getImageTag(128)} + {@$user->getAvatar()->getImageTag(128)} {include file='email_userInformationHeadline'}
{/capture} {include file='email_paddingHelper' block=true class='box128' content=$userContent sandbox=true} -
- {lang}wcf.user.notification.follow.mail.html{/lang} {/if} diff --git a/com.woltlab.wcf/templates/email_notification_userProfileComment.tpl b/com.woltlab.wcf/templates/email_notification_userProfileComment.tpl new file mode 100644 index 0000000000..f581ea24d7 --- /dev/null +++ b/com.woltlab.wcf/templates/email_notification_userProfileComment.tpl @@ -0,0 +1,32 @@ +{if $mimeType === 'text/plain'} +{lang}wcf.user.notification.comment.mail.plaintext{/lang} +{$event->getUserNotificationObject()->message} +{else} + {lang}wcf.user.notification.comment.mail.html{/lang} + {assign var='user' value=$event->getAuthor()} + {assign var='comment' value=$event->getUserNotificationObject()} + {capture assign='userContent'} + + + + + +
{@$user->getAvatar()->getImageTag(128)} +
+

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

+
+
+ {$comment->message} +
+
+ {/capture} + {include file='email_paddingHelper' block=true class='box128' content=$userContent sandbox=true} +{/if} 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 52cfecfe0e..ad15f67d36 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 @@ -1,5 +1,6 @@ getObject($this->getUserNotificationObject()->objectID); - - $authors = $this->getAuthors(); - if (count($authors) > 1) { - if (isset($authors[0])) { - unset($authors[0]); - } - $count = count($authors); - - return $this->getLanguage()->getDynamicVariable('wcf.user.notification.comment.mail.stacked', [ - 'author' => $this->author, - 'authors' => array_values($authors), - 'count' => $count, - 'others' => $count - 1, - 'owner' => $user, - 'notificationType' => $notificationType, - 'guestTimesTriggered' => $this->notification->guestTimesTriggered - ]); - } - - return $this->getLanguage()->getDynamicVariable('wcf.user.notification.comment.mail', [ - 'comment' => $this->userNotificationObject, - 'author' => $this->author, - 'owner' => $user, - 'notificationType' => $notificationType - ]); + return [ + 'template' => 'email_notification_userProfileComment', + 'application' => 'wcf', + 'variables' => [ + 'owner' => new User($this->getUserNotificationObject()->objectID) + ] + ]; } /** diff --git a/wcfsetup/install/lang/de.xml b/wcfsetup/install/lang/de.xml index d4a3c2f68c..b11b239c29 100644 --- a/wcfsetup/install/lang/de.xml +++ b/wcfsetup/install/lang/de.xml @@ -3283,19 +3283,13 @@ Benachrichtigungen auf {PAGE_TITLE|language getAnchorTag()} folgt {if LANGUAGE_USE_INFORMAL_VARIANT}dir{else}Ihnen{/if}.]]> getAnchorTag()}{if $count == 2} und {else}, {/if}{@$authors[1]->getAnchorTag()}{if $count == 3} und {@$authors[2]->getAnchorTag()}{/if}{else}{@$authors[0]->getAnchorTag()} und {#$others} weiteren{/if} folgen {if LANGUAGE_USE_INFORMAL_VARIANT}dir{else}Ihnen{/if}.]]> getAuthor()->username} [URL:{link controller='User' object=$event->getAuthor() isEmail=true}{/link}] folgt {if LANGUAGE_USE_INFORMAL_VARIANT}dir{else}Ihnen{/if}.]]> - {$event->getAuthor()->username} folgt {if LANGUAGE_USE_INFORMAL_VARIANT}dir{else}Ihnen{/if}.

]]> + {$event->getAuthor()->username} folgt {if LANGUAGE_USE_INFORMAL_VARIANT}dir{else}Ihnen{/if}:

]]>
userID}Ein Gast{else}{@$author->getAnchorTag()}{/if} hat einen Kommentar an {if LANGUAGE_USE_INFORMAL_VARIANT}deiner{else}Ihrer{/if} Pinnwand verfasst.]]> getAnchorTag()}{if $count != 1}{if $count == 2 && !$guestTimesTriggered} und {else}, {/if}{@$authors[1]->getAnchorTag()}{if $count == 3}{if !$guestTimesTriggered} und {else}, {/if} {@$authors[2]->getAnchorTag()}{/if}{/if}{if $guestTimesTriggered} und {if $guestTimesTriggered == 1}ein Gast{else}Gäste{/if}{/if}{else}{@$authors[0]->getAnchorTag()}{if $guestTimesTriggered},{else} und{/if} {#$others} weitere Benutzer {if $guestTimesTriggered}und {if $guestTimesTriggered == 1}ein Gast{else}Gäste{/if}{/if}{/if} haben Kommentare an {if LANGUAGE_USE_INFORMAL_VARIANT}deiner{else}Ihrer{/if} Pinnwand verfasst.]]> - userID}ein Gast{else}{@$author->username}{/if} hat einen Kommentar an {if LANGUAGE_USE_INFORMAL_VARIANT}deiner{else}Ihrer{/if} Pinnwand verfasst: -{if $notificationType == 'instant'} ---------------------------------- -{@$comment->message} ---------------------------------- -{/if}{link controller='User' object=$owner isEmail=true}#wall{/link}]]> - username}{if $count != 1}{if $count == 2 && !$guestTimesTriggered} und {else}, {/if}{@$authors[1]->username}{if $count == 3}{if !$guestTimesTriggered} und {else}, {/if} {@$authors[2]->username}{/if}{/if}{if $guestTimesTriggered} und {if $guestTimesTriggered == 1}ein Gast{else}Gäste{/if}{/if}{else}{@$authors[0]->username}{if $guestTimesTriggered},{else} und{/if} {#$others} weitere Benutzer {if $guestTimesTriggered}und {if $guestTimesTriggered == 1}ein Gast{else}Gäste{/if}{/if}{/if} haben Kommentare an Ihrer Pinnwand verfasst: -{link controller='User' object=$owner isEmail=true}#wall{/link}]]> + getAuthor()->userID}ein Gast{else}{@$event->getAuthor()->username} [URL:{link controller='User' object=$event->getAuthor() isEmail=true}{/link}]{/if} hat einen Kommentar an {if LANGUAGE_USE_INFORMAL_VARIANT}deiner{else}Ihrer{/if} Pinnwand [URL:{link controller='User' object=$notificationContent[variables][owner] isEmail=true}#wall{/link}] verfasst:]]> + {if !$event->getAuthor()->userID}ein Gast{else}{@$event->getAuthor()->username}{/if} hat einen Kommentar an {if LANGUAGE_USE_INFORMAL_VARIANT}deiner{else}Ihrer{/if} Pinnwand verfasst:

]]>
getAnchorTag()} gefällt {if LANGUAGE_USE_INFORMAL_VARIANT}dein{else}Ihr{/if} Kommentar an {if $owner === null}{if LANGUAGE_USE_INFORMAL_VARIANT}deiner{else}Ihrer{/if} Pinnwand{else}der Pinnwand von {$owner->username}{/if}.]]> diff --git a/wcfsetup/install/lang/en.xml b/wcfsetup/install/lang/en.xml index 4d24c40811..777b3a6847 100644 --- a/wcfsetup/install/lang/en.xml +++ b/wcfsetup/install/lang/en.xml @@ -3320,19 +3320,13 @@ If you do not want to receive further email notifications for this event, you ca getAnchorTag()} follows you.]]> getAnchorTag()}{if $count == 2} and {else}, {/if}{@$authors[1]->getAnchorTag()}{if $count == 3} and {@$authors[2]->getAnchorTag()}{/if}{else}{@$authors[0]->getAnchorTag()} and {#$others} others{/if} follow you.]]> getAuthor()->username} [URL:{link controller='User' object=$event->getAuthor() isEmail=true}{/link}] is following you.]]> - getAuthor() isEmail=true}{/link}">{$event->getAuthor()->username} is following you.]]> + {$event->getAuthor()->username} is following you:

]]>
userID}A guest{else}{@$author->getAnchorTag()}{/if} wrote a comment on your wall.]]> getAnchorTag()}{if $count != 1}{if $count == 2 && !$guestTimesTriggered} and {else}, {/if}{@$authors[1]->getAnchorTag()}{if $count == 3}{if !$guestTimesTriggered} and {else}, {/if} {@$authors[2]->getAnchorTag()}{/if}{/if}{if $guestTimesTriggered} and {if $guestTimesTriggered == 1}a guest{else}guests{/if}{/if}{else}{@$authors[0]->getAnchorTag()}{if $guestTimesTriggered},{else} and{/if} {#$others} other users {if $guestTimesTriggered}and {if $guestTimesTriggered == 1}a guest{else}guests{/if}{/if}{/if} wrote comments on your wall.]]> - userID}a guest{else}{@$author->username}{/if} wrote a comment on your wall: -{if $notificationType == 'instant'} ---------------------------------- -{@$comment->message} ---------------------------------- -{/if}{link controller='User' object=$owner isEmail=true}#wall{/link}]]> - username}{if $count != 1}{if $count == 2 && !$guestTimesTriggered} and {else}, {/if}{@$authors[1]->username}{if $count == 3}{if !$guestTimesTriggered} and {else}, {/if} {@$authors[2]->username}{/if}{/if}{if $guestTimesTriggered} and {if $guestTimesTriggered == 1}a guest{else}guests{/if}{/if}{else}{@$authors[0]->username}{if $guestTimesTriggered},{else} and{/if} {#$others} other users {if $guestTimesTriggered}and {if $guestTimesTriggered == 1}a guest{else}guests{/if}{/if}{/if} wrote comments on your wall: -{link controller='User' object=$owner isEmail=true}#wall{/link}]]> + getAuthor()->userID}ein Gast{else}{@$event->getAuthor()->username} [URL:{link controller='User' object=$event->getAuthor() isEmail=true}{/link}]{/if} wrote a comment on your wall [URL:{link controller='User' object=$notificationContent[variables][owner] isEmail=true}#wall{/link}]:]]> + {if !$event->getAuthor()->userID}ein Gast{else}{@$event->getAuthor()->username}{/if} wrote a comment your wall:

]]>
getAnchorTag()} likes your comment on {if $owner === null}your wall{else}{$owner->username}’s wall{/if}.]]> -- 2.20.1