Add notification links to notification tests
authorMatthias Schmidt <gravatronics@live.com>
Sat, 5 Aug 2017 10:29:39 +0000 (12:29 +0200)
committerMatthias Schmidt <gravatronics@live.com>
Sat, 5 Aug 2017 10:29:39 +0000 (12:29 +0200)
See #2359

wcfsetup/install/files/acp/templates/devtoolsNotificationTestDialog.tpl
wcfsetup/install/files/lib/data/user/notification/event/UserNotificationEventAction.class.php
wcfsetup/install/lang/de.xml
wcfsetup/install/lang/en.xml

index fc7fc58a77471113afb7ea29e628fb12e9caabf9..06bc836afac44f45f578a117148011640a60d8c4 100644 (file)
                                </dl>
                        {/if}
                        
+                       {if $event[link]|isset}
+                               <dl>
+                                       <dt>{lang}wcf.acp.devtools.notificationTest.link{/lang}</dt>
+                                       <dd><a href="{@$event[link]}">{@$event[link]}</a></dd>
+                               </dl>
+                       {else}
+                               <dl>
+                                       <dt>{lang}wcf.acp.devtools.notificationTest.link.exception{/lang}</dt>
+                                       <dd><pre>{$event[linkException]}</pre></dd>
+                               </dl>
+                       {/if}
+                       
                        {if $hasEmailSupport}
                                {if $event[instantEmail]|isset}
                                        <dl>
        </dl>
 </section>
 
+<section class="section notificationTestSection" id="notificationTestLinkSection" style="display: none;">
+       <h2 class="sectionTitle">{lang}wcf.acp.devtools.notificationTest.links{/lang}</h2>
+       
+       <dl>
+               {foreach from=$events item=event}
+                       <dt>{$event[description]}</dt>
+                       <dd>{if $event[link]|isset}<a href="{@$event[link]}">{@$event[link]}</a>{else}<pre>{$event[linkException]}</pre>{/if}</dd>
+               {/foreach}
+       </dl>
+</section>
+
 {if $hasEmailSupport}
        <section class="section notificationTestSection" id="notificationTestInstantEmailSection" style="display: none;">
                <h2 class="sectionTitle">{lang}wcf.acp.devtools.notificationTest.instantEmails{/lang}</h2>
        <button class="small buttonPrimary" id="notificationTestAllSectionButton">{lang}wcf.acp.devtools.notificationTest.button.showAll{/lang}</button>
        <button class="small button" id="notificationTestTitleSectionButton">{lang}wcf.acp.devtools.notificationTest.titles{/lang}</button>
        <button class="small button" id="notificationTestMessageSectionButton">{lang}wcf.acp.devtools.notificationTest.messages{/lang}</button>
+       <button class="small button" id="notificationTestLinkSectionButton">{lang}wcf.acp.devtools.notificationTest.links{/lang}</button>
        {if $hasEmailSupport}
                <button class="small button" id="notificationTestInstantEmailSectionButton">{lang}wcf.acp.devtools.notificationTest.instantEmails{/lang}</button>
                <button class="small button" id="notificationTestDailyEmailSectionButton">{lang}wcf.acp.devtools.notificationTest.dailyEmails{/lang}</button>
index 7973ade3b52091323788d40c040500171e1c3bda..e875933e4bfa15cc2ccad3759f98676658c59672 100644 (file)
@@ -135,6 +135,18 @@ class UserNotificationEventAction extends AbstractDatabaseObjectAction {
                                $errors++;
                        }
                        
+                       try {
+                               $eventData['link'] = $event->getLink();
+                       }
+                       catch (\Exception $e) {
+                               $eventData['linkException'] = $getRenderedException($e);
+                               $errors++;
+                       }
+                       catch (\Throwable $e) {
+                               $eventData['linkException'] = $getRenderedException($e);
+                               $errors++;
+                       }
+                       
                        if ($event->supportsEmailNotification()) {
                                $hasEmailSupport = true;
                                
index b091d44c952a17569d511afe074d0a7ebd3f3485..fc57763d8ce69e1478822433e8606be1775bcb40 100644 (file)
                <item name="wcf.acp.devtools.notificationTest.messages"><![CDATA[Nachrichten]]></item>
                <item name="wcf.acp.devtools.notificationTest.instantEmails"><![CDATA[Sofortige E-Mails]]></item>
                <item name="wcf.acp.devtools.notificationTest.dailyEmails"><![CDATA[Tägliche E-Mails]]></item>
+               <item name="wcf.acp.devtools.notificationTest.link"><![CDATA[Link]]></item>
+               <item name="wcf.acp.devtools.notificationTest.link.exception"><![CDATA[Link-Fehlermeldung]]></item>
+               <item name="wcf.acp.devtools.notificationTest.links"><![CDATA[Links]]></item>
        </category>
        
        <category name="wcf.acp.email">
index fe3ddc51e9547e4c0e5146aa93ec0b571c704d8d..617cca4277fb61b97d67399720bef25cdd153610 100644 (file)
                <item name="wcf.acp.devtools.notificationTest.messages"><![CDATA[Messages]]></item>
                <item name="wcf.acp.devtools.notificationTest.instantEmails"><![CDATA[Instant Emails]]></item>
                <item name="wcf.acp.devtools.notificationTest.dailyEmails"><![CDATA[Daily Emails]]></item>
+               <item name="wcf.acp.devtools.notificationTest.link"><![CDATA[Link]]></item>
+               <item name="wcf.acp.devtools.notificationTest.link.exception"><![CDATA[Link Error Message]]></item>
+               <item name="wcf.acp.devtools.notificationTest.links"><![CDATA[Links]]></item>
        </category>
        
        <category name="wcf.acp.email">