Convert email notifications for wall comments to new API
authorTim Düsterhus <duesterhus@woltlab.com>
Fri, 17 Jun 2016 18:36:13 +0000 (20:36 +0200)
committerTim Düsterhus <duesterhus@woltlab.com>
Fri, 29 Jul 2016 14:25:53 +0000 (16:25 +0200)
com.woltlab.wcf/templates/email_html.tpl
com.woltlab.wcf/templates/email_notification_userFollowFollowing.tpl
com.woltlab.wcf/templates/email_notification_userProfileComment.tpl [new file with mode: 0644]
wcfsetup/install/files/lib/system/user/notification/event/UserProfileCommentUserNotificationEvent.class.php
wcfsetup/install/lang/de.xml
wcfsetup/install/lang/en.xml

index 030e52da6aec9883a35afa2bb531008c12437452..74027982b4d81974543aedabe69e1e683e3a90ea 100644 (file)
                        font-size: {$style->getVariable('wcfFontSizeTitle')};
                        color: {$style->getVariable('wcfContentHeadlineText')};
                }
+               small {
+                       font-size: {$style->getVariable('wcfFontSizeSmall')};
+                       font-weight: 300;
+               }
                
                {* Buttons *}
                td.button {
                        padding: 20px;
                }
                
+               .box128 td.boxContent {
+                       padding-left: 20px;
+               }
+               
                .containerHeadline h3 {
                        margin: 0;
                        padding: 0;
+                       font-weight: 400;
                }
                </style>
        </head>
index 7618d204bc4a5c8db73c5a2e8b47a9742d6f3ba0..474603f6d4f66e273ad8a2c73f4861849664e718 100644 (file)
@@ -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'}
        <table cellpadding="0" cellspacing="0" border="0">
                <tr>
-                       <td><a href="{link controller='User' object=$user}{/link}" title="{$user->username}">{@$user->getAvatar()->getImageTag(128)}</a></td>
-                       <td>
+                       <td><a href="{link controller='User' object=$user isEmail=true}{/link}" title="{$user->username}">{@$user->getAvatar()->getImageTag(128)}</a></td>
+                       <td class="boxContent">
                                {include file='email_userInformationHeadline'}
                        </td>
                </tr>
        </table>
        {/capture}
        {include file='email_paddingHelper' block=true class='box128' content=$userContent sandbox=true}
-       <br style="clear:both">
-       {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 (file)
index 0000000..f581ea2
--- /dev/null
@@ -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'}
+       <table cellpadding="0" cellspacing="0" border="0">
+               <tr>
+                       <td><a href="{link controller='User' object=$user isEmail=true}{/link}" title="{$comment->username}">{@$user->getAvatar()->getImageTag(128)}</a></td>
+                       <td class="boxContent">
+                               <div class="containerHeadline">
+                                       <h3>
+                                               {if $comment->userID}
+                                                       <a href="{link controller='User' object=$user isEmail=true}{/link}">{$comment->username}</a>
+                                               {else}
+                                                       {$comment->username}
+                                               {/if}
+                                               &#xb7;
+                                               <small>{$comment->time|plainTime}</small>
+                                       </h3>
+                               </div>
+                               <div>
+                                       {$comment->message}
+                               </div>
+                       </td>
+               </tr>
+       </table>
+       {/capture}
+       {include file='email_paddingHelper' block=true class='box128' content=$userContent sandbox=true}
+{/if}
index 52cfecfe0e37e471a7ed17e7e334d1e629c525ec..ad15f67d366855eb1c047ebc7bf62c05d6f1b406 100644 (file)
@@ -1,5 +1,6 @@
 <?php
 namespace wcf\system\user\notification\event;
+use wcf\data\user\User;
 use wcf\system\cache\runtime\UserProfileRuntimeCache;
 use wcf\system\request\LinkHandler;
 use wcf\system\user\notification\object\CommentUserNotificationObject;
@@ -71,32 +72,13 @@ class UserProfileCommentUserNotificationEvent extends AbstractSharedUserNotifica
         * @inheritDoc
         */
        public function getEmailMessage($notificationType = 'instant') {
-               $user = UserProfileRuntimeCache::getInstance()->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)
+                       ]
+               ];
        }
        
        /**
index d4a3c2f68c0dc5b1a5b4ff8e79674df0aefda0ed..b11b239c298812b46277ee6b607d3b560612e667 100644 (file)
@@ -3283,19 +3283,13 @@ Benachrichtigungen auf <a href="{link isEmail=true}{/link}">{PAGE_TITLE|language
                <item name="wcf.user.notification.follow.message"><![CDATA[{@$author->getAnchorTag()} folgt {if LANGUAGE_USE_INFORMAL_VARIANT}dir{else}Ihnen{/if}.]]></item>
                <item name="wcf.user.notification.follow.message.stacked"><![CDATA[{if $count < 4}{@$authors[0]->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}.]]></item>
                <item name="wcf.user.notification.follow.mail.plaintext"><![CDATA[{@$event->getAuthor()->username} [URL:{link controller='User' object=$event->getAuthor() isEmail=true}{/link}] folgt {if LANGUAGE_USE_INFORMAL_VARIANT}dir{else}Ihnen{/if}.]]></item>
-               <item name="wcf.user.notification.follow.mail.html"><![CDATA[<p><a href="{link controller='User' object=$event->getAuthor() isEmail=true}{/link}">{$event->getAuthor()->username}</a> folgt {if LANGUAGE_USE_INFORMAL_VARIANT}dir{else}Ihnen{/if}.</p>]]></item>
+               <item name="wcf.user.notification.follow.mail.html"><![CDATA[<p><a href="{link controller='User' object=$event->getAuthor() isEmail=true}{/link}">{$event->getAuthor()->username}</a> folgt {if LANGUAGE_USE_INFORMAL_VARIANT}dir{else}Ihnen{/if}:</p>]]></item>
                <item name="wcf.user.notification.comment.title"><![CDATA[Neuer Kommentar (Pinnwand)]]></item>
                <item name="wcf.user.notification.comment.title.stacked"><![CDATA[{#$timesTriggered} neue Kommentare (Pinnwand)]]></item>
                <item name="wcf.user.notification.comment.message"><![CDATA[{if !$author->userID}Ein Gast{else}{@$author->getAnchorTag()}{/if} hat einen Kommentar an <a href="{link controller='User' object=$__wcf->getUser()}#wall{/link}">{if LANGUAGE_USE_INFORMAL_VARIANT}deiner{else}Ihrer{/if} Pinnwand</a> verfasst.]]></item>
                <item name="wcf.user.notification.comment.message.stacked"><![CDATA[{if $count < 4}{@$authors[0]->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 <a href="{link controller='User' object=$__wcf->getUser()}#wall{/link}">{if LANGUAGE_USE_INFORMAL_VARIANT}deiner{else}Ihrer{/if} Pinnwand</a> verfasst.]]></item>
-               <item name="wcf.user.notification.comment.mail"><![CDATA[{if !$author->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}]]></item>
-               <item name="wcf.user.notification.comment.mail.stacked"><![CDATA[{if $count < 4}{@$authors[0]->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}]]></item>
+               <item name="wcf.user.notification.comment.mail.plaintext"><![CDATA[{if !$event->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:]]></item>
+               <item name="wcf.user.notification.comment.mail.html"><![CDATA[<p>{if !$event->getAuthor()->userID}ein Gast{else}<a href="{link controller='User' object=$event->getAuthor() isEmail=true}{/link}">{@$event->getAuthor()->username}</a>{/if} hat einen Kommentar an <a href="{link controller='User' object=$notificationContent[variables][owner] isEmail=true}#wall{/link}">{if LANGUAGE_USE_INFORMAL_VARIANT}deiner{else}Ihrer{/if} Pinnwand</a> verfasst:</p>]]></item>
                <item name="wcf.user.notification.comment.like.title"><![CDATA[Gefällt ein Kommentar (Pinnwand)]]></item>
                <item name="wcf.user.notification.comment.like.title.stacked"><![CDATA[{#$count} Benutzern gefällt {if LANGUAGE_USE_INFORMAL_VARIANT}dein{else}Ihr{/if} Kommentar (Pinnwand)]]></item>
                <item name="wcf.user.notification.comment.like.message"><![CDATA[{@$author->getAnchorTag()} gefällt {if LANGUAGE_USE_INFORMAL_VARIANT}dein{else}Ihr{/if} Kommentar an {if $owner === null}<a href="{link controller='User' object=$__wcf->getUser()}#wall{/link}">{if LANGUAGE_USE_INFORMAL_VARIANT}deiner{else}Ihrer{/if} Pinnwand</a>{else}der <a href="{link controller='User' object=$owner}#wall{/link}">Pinnwand von {$owner->username}</a>{/if}.]]></item>
index 4d24c408111d95c18260305fc7f6025ff81b67fa..777b3a684704435265cc002d6cf07955f440c88f 100644 (file)
@@ -3320,19 +3320,13 @@ If you do not want to receive further email notifications for this event, you ca
                <item name="wcf.user.notification.follow.message"><![CDATA[{@$author->getAnchorTag()} follows you.]]></item>
                <item name="wcf.user.notification.follow.message.stacked"><![CDATA[{if $count < 4}{@$authors[0]->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.]]></item>
                <item name="wcf.user.notification.follow.mail.plaintext"><![CDATA[{@$event->getAuthor()->username} [URL:{link controller='User' object=$event->getAuthor() isEmail=true}{/link}] is following you.]]></item>
-               <item name="wcf.user.notification.follow.mail.html"><![CDATA[<a href="{link controller='User' object=$event->getAuthor() isEmail=true}{/link}">{$event->getAuthor()->username}</a> is following you.]]></item>
+               <item name="wcf.user.notification.follow.mail.html"><![CDATA[<p><a href="{link controller='User' object=$event->getAuthor() isEmail=true}{/link}">{$event->getAuthor()->username}</a> is following you:</p>]]></item>
                <item name="wcf.user.notification.comment.title"><![CDATA[New Comment (Wall)]]></item>
                <item name="wcf.user.notification.comment.title.stacked"><![CDATA[{#$timesTriggered} new comments (Wall)]]></item>
                <item name="wcf.user.notification.comment.message"><![CDATA[{if !$author->userID}A guest{else}{@$author->getAnchorTag()}{/if} wrote a comment on <a href="{link controller='User' object=$__wcf->getUser()}#wall{/link}">your wall</a>.]]></item>
                <item name="wcf.user.notification.comment.message.stacked"><![CDATA[{if $count < 4}{@$authors[0]->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 <a href="{link controller='User' object=$__wcf->getUser()}#wall{/link}">your wall</a>.]]></item>
-               <item name="wcf.user.notification.comment.mail"><![CDATA[{if !$author->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}]]></item>
-               <item name="wcf.user.notification.comment.mail.stacked"><![CDATA[{if $count < 4}{@$authors[0]->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}]]></item>
+               <item name="wcf.user.notification.comment.mail.plaintext"><![CDATA[{if !$event->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}]:]]></item>
+               <item name="wcf.user.notification.comment.mail.html"><![CDATA[<p>{if !$event->getAuthor()->userID}ein Gast{else}<a href="{link controller='User' object=$event->getAuthor() isEmail=true}{/link}">{@$event->getAuthor()->username}</a>{/if} wrote a comment <a href="{link controller='User' object=$notificationContent[variables][owner] isEmail=true}#wall{/link}">your wall</a>:</p>]]></item>
                <item name="wcf.user.notification.comment.like.title"><![CDATA[Likes a comment (Wall)]]></item>
                <item name="wcf.user.notification.comment.like.title.stacked"><![CDATA[{#$count} users like your comment (Wall)]]></item>
                <item name="wcf.user.notification.comment.like.message"><![CDATA[{@$author->getAnchorTag()} likes your comment on {if $owner === null}<a href="{link controller='User' object=$__wcf->getUser()}#wall{/link}">your wall</a>{else}<a href="{link controller='User' object=$owner}#wall{/link}">{$owner->username}’s wall</a>{/if}.]]></item>