Added notifications for comment (response) likes
authorAlexander Ebert <ebert@woltlab.com>
Wed, 25 Jun 2014 12:32:33 +0000 (14:32 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Wed, 25 Jun 2014 12:32:33 +0000 (14:32 +0200)
19 files changed:
com.woltlab.wcf/objectType.xml
com.woltlab.wcf/templates/notificationSettings.tpl
com.woltlab.wcf/userNotificationEvent.xml
wcfsetup/install/files/lib/data/comment/LikeableComment.class.php
wcfsetup/install/files/lib/data/comment/response/LikeableCommentResponse.class.php
wcfsetup/install/files/lib/data/like/object/AbstractLikeObject.class.php
wcfsetup/install/files/lib/data/like/object/ILikeObject.class.php
wcfsetup/install/files/lib/system/like/LikeHandler.class.php
wcfsetup/install/files/lib/system/user/notification/UserNotificationHandler.class.php
wcfsetup/install/files/lib/system/user/notification/event/AbstractUserNotificationEvent.class.php
wcfsetup/install/files/lib/system/user/notification/event/IUserNotificationEvent.class.php
wcfsetup/install/files/lib/system/user/notification/event/UserProfileCommentLikeUserNotificationEvent.class.php [new file with mode: 0644]
wcfsetup/install/files/lib/system/user/notification/event/UserProfileCommentResponseLikeUserNotificationEvent.class.php [new file with mode: 0644]
wcfsetup/install/files/lib/system/user/notification/object/CommentLikeUserNotificationObject.class.php [new file with mode: 0644]
wcfsetup/install/files/lib/system/user/notification/object/CommentResponseLikeUserNotificationObject.class.php [new file with mode: 0644]
wcfsetup/install/files/lib/system/user/notification/object/type/UserProfileCommentLikeUserNotificationObjectType.class.php [new file with mode: 0644]
wcfsetup/install/files/lib/system/user/notification/object/type/UserProfileCommentResponseLikeUserNotificationObjectType.class.php [new file with mode: 0644]
wcfsetup/install/lang/de.xml
wcfsetup/install/lang/en.xml

index fb60484a924fbc59d29ff91bc8acbab612990e17..5609043636a0a74a6f3ffbc01a4416d182f1857a 100644 (file)
                        <classname><![CDATA[wcf\system\user\notification\object\type\UserProfileCommentResponseUserNotificationObjectType]]></classname>
                        <category>com.woltlab.wcf.user</category>
                </type>
+               
+               <type>
+                       <name>com.woltlab.wcf.user.profileComment.like.notification</name>
+                       <definitionname>com.woltlab.wcf.notification.objectType</definitionname>
+                       <classname><![CDATA[wcf\system\user\notification\object\type\UserProfileCommentLikeUserNotificationObjectType]]></classname>
+                       <category>com.woltlab.wcf.user</category>
+               </type>
+               <type>
+                       <name>com.woltlab.wcf.user.profileComment.response.like.notification</name>
+                       <definitionname>com.woltlab.wcf.notification.objectType</definitionname>
+                       <classname><![CDATA[wcf\system\user\notification\object\type\UserProfileCommentResponseLikeUserNotificationObjectType]]></classname>
+                       <category>com.woltlab.wcf.user</category>
+               </type>
                <!-- /comments -->
                
                <!-- moderation -->
index cd70385abeaead636057b1b80d622ab48e593ae8..5129d75e96dfdfa0deed2d47d4be6d76df8d9d26 100644 (file)
                                <legend>{lang}wcf.user.notification.{$eventCategory}{/lang}</legend>
                                
                                <dl>
-                                       {foreach from=$eventList item='event'}
+                                       {foreach from=$eventList item=event}
                                                <dd>
                                                        <label><input type="checkbox" name="settings[{@$event->eventID}][enabled]" value="1"{if $settings[$event->eventID][enabled]} checked="checked"{/if} /> {lang}wcf.user.notification.{$event->objectType}.{$event->eventName}{/lang}</label>
                                                        {hascontent}<small>{content}{lang __optional=true}wcf.user.notification.{$event->objectType}.{$event->eventName}.description{/lang}{/content}</small>{/hascontent}
-                                                       <small class="jsMailNotificationType">
-                                                               <select name="settings[{@$event->eventID}][mailNotificationType]">
-                                                                       <option value="none">{lang}wcf.user.notification.mailNotificationType.none{/lang}</option>
-                                                                       <option value="instant"{if $settings[$event->eventID][mailNotificationType] == 'instant'} selected="selected"{/if}>{lang}wcf.user.notification.mailNotificationType.instant{/lang}</option>
-                                                                       <option value="daily"{if $settings[$event->eventID][mailNotificationType] == 'daily'} selected="selected"{/if}>{lang}wcf.user.notification.mailNotificationType.daily{/lang}</option>
-                                                               </select>
-                                                       </small>
+                                                       {if $event->supportsEmailNotification()}
+                                                               <small class="jsMailNotificationType">
+                                                                       <select name="settings[{@$event->eventID}][mailNotificationType]">
+                                                                               <option value="none">{lang}wcf.user.notification.mailNotificationType.none{/lang}</option>
+                                                                               <option value="instant"{if $settings[$event->eventID][mailNotificationType] == 'instant'} selected="selected"{/if}>{lang}wcf.user.notification.mailNotificationType.instant{/lang}</option>
+                                                                               <option value="daily"{if $settings[$event->eventID][mailNotificationType] == 'daily'} selected="selected"{/if}>{lang}wcf.user.notification.mailNotificationType.daily{/lang}</option>
+                                                                       </select>
+                                                               </small>
+                                                       {else}
+                                                               <small class="jsMailNotificationType">{lang}wcf.user.notification.mailNotificationType.notSupported{/lang}</small>
+                                                       {/if}
                                                </dd>
                                        {/foreach}
                                </dl>
index d71b9102f9c06eeea82ca4a75d0b61079496d9ab..516976a0077c7233748d01189c46087fb49d035a 100644 (file)
                        <classname><![CDATA[wcf\system\user\notification\event\UserProfileCommentResponseOwnerUserNotificationEvent]]></classname>
                        <preset>1</preset>
                </event>
+               
+               <event>
+                       <name>like</name>
+                       <objecttype>com.woltlab.wcf.user.profileComment.like.notification</objecttype>
+                       <classname><![CDATA[wcf\system\user\notification\event\UserProfileCommentUserNotificationEvent]]></classname>
+                       <preset>1</preset>
+               </event>
+               <event>
+                       <name>like</name>
+                       <objecttype>com.woltlab.wcf.user.profileComment.like.response.notification</objecttype>
+                       <classname><![CDATA[wcf\system\user\notification\event\UserProfileCommentResponseUserNotificationEvent]]></classname>
+                       <preset>1</preset>
+               </event>
        </import>
 </data>
index 34cb0c6c06d0968de01e0cfa6beb6b14b984501a..d81d4531d73f4d68c23052189834119edb158285 100644 (file)
@@ -1,7 +1,14 @@
 <?php
 namespace wcf\data\comment;
 use wcf\data\like\object\AbstractLikeObject;
+use wcf\data\like\Like;
 use wcf\data\object\type\ObjectTypeCache;
+use wcf\system\comment\CommentHandler;
+use wcf\system\user\notification\object\CommentLikeUserNotificationObject;
+use wcf\system\user\notification\UserNotificationHandler;
+use wcf\system\WCF;
+
+
 
 /**
  * Likeable object implementation for comments.
@@ -50,4 +57,18 @@ class LikeableComment extends AbstractLikeObject {
                
                return $this->objectType;
        }
+       
+       /**
+        * @see \wcf\data\like\object\ILikeObject::sendNotification()
+        */
+       public function sendNotification(Like $like) {
+               $objectType = CommentHandler::getInstance()->getObjectType($this->object->objectTypeID);
+               if (UserNotificationHandler::getInstance()->getObjectTypeID($objectType->objectType.'.like.notification')) {
+                       $notificationObjectType = UserNotificationHandler::getInstance()->getObjectTypeProcessor($objectType->objectType.'.like.notification');
+                       if ($this->userID != WCF::getUser()->userID) {
+                               $notificationObject = new CommentLikeUserNotificationObject($like);
+                               UserNotificationHandler::getInstance()->fireEvent('like', $objectType->objectType.'.like.notification', $notificationObject, array($this->userID), array('objectID' => $this->object->objectID));
+                       }
+               }
+       }
 }
index 97cc4c819bcbdf82dcf8df0559bf350d8ffe5b10..c31e866d6d2d0530bdf5d2aef3c03ff19046b604 100644 (file)
@@ -1,7 +1,13 @@
 <?php
 namespace wcf\data\comment\response;
+use wcf\data\comment\Comment;
 use wcf\data\like\object\AbstractLikeObject;
+use wcf\data\like\Like;
 use wcf\data\object\type\ObjectTypeCache;
+use wcf\system\comment\CommentHandler;
+use wcf\system\user\notification\object\CommentResponseLikeUserNotificationObject;
+use wcf\system\user\notification\UserNotificationHandler;
+use wcf\system\WCF;
 
 /**
  * Likeable object implementation for comment reponses.
@@ -50,4 +56,23 @@ class LikeableCommentResponse extends AbstractLikeObject {
        public function getUserID() {
                return $this->userID;
        }
+       
+       /**
+        * @see \wcf\data\like\object\ILikeObject::sendNotification()
+        */
+       public function sendNotification(Like $like) {
+               $comment = new Comment($this->object->commentID);
+               $objectType = CommentHandler::getInstance()->getObjectType($comment->objectTypeID);
+               if (UserNotificationHandler::getInstance()->getObjectTypeID($objectType->objectType.'.response.like.notification')) {
+                       $notificationObjectType = UserNotificationHandler::getInstance()->getObjectTypeProcessor($objectType->objectType.'.response.like.notification');
+                       if ($this->userID != WCF::getUser()->userID) {
+                               $notificationObject = new CommentResponseLikeUserNotificationObject($like);
+                               UserNotificationHandler::getInstance()->fireEvent('like', $objectType->objectType.'.response.like.notification', $notificationObject, array($this->userID), array(
+                                       'commentID' => $comment->commentID,
+                                       'commentUserID' => $comment->userID,
+                                       'objectID' => $comment->objectID,
+                               ));
+                       }
+               }
+       }
 }
index 17bdda4599409836468b86dfc77b53328b3667ea..49808ee0680285cc0312351d47d0320b9c04e7e1 100644 (file)
@@ -1,5 +1,6 @@
 <?php
 namespace wcf\data\like\object;
+use wcf\data\like\Like;
 use wcf\data\object\type\ObjectType;
 use wcf\data\DatabaseObjectDecorator;
 
@@ -43,4 +44,11 @@ abstract class AbstractLikeObject extends DatabaseObjectDecorator implements ILi
        public function setObjectType(ObjectType $objectType) {
                $this->objectType = $objectType;
        }
+       
+       /**
+        * @see \wcf\data\like\object\ILikeObject::sendNotification()
+        */
+       public function sendNotification(Like $like) {
+               // individual implementations can override this method to provide notifications
+       }
 }
index b93089952a27aaec22c2fab94df8abf796074e5e..dd8a9498dac485822e03a314dda24a4cc4841571 100644 (file)
@@ -1,5 +1,6 @@
 <?php
 namespace wcf\data\like\object;
+use wcf\data\like\Like;
 use wcf\data\object\type\ObjectType;
 use wcf\data\IDatabaseObjectProcessor;
 use wcf\data\ITitledObject;
@@ -56,4 +57,11 @@ interface ILikeObject extends IDatabaseObjectProcessor, ITitledObject {
         * @param       \wcf\data\object\type\ObjectType
         */
        public function setObjectType(ObjectType $objectType);
+       
+       /**
+        * Sends a notification for this like.
+        * 
+        * @param       \wcf\data\like\Like     $like
+        */
+       public function sendNotification(Like $like);
 }
index a345f2c8b93c24b2658d5f8587ed492b30ff05c7..5ca7a1f715429a2e2a718d66e448f7190caf1202 100644 (file)
@@ -285,7 +285,10 @@ class LikeHandler extends SingletonFactory {
                                        'likeValue' => $likeValue
                                ));
                                
-                               if ($likeValue == Like::LIKE && $likeable->getUserID()) UserActivityPointHandler::getInstance()->fireEvent('com.woltlab.wcf.like.activityPointEvent.receivedLikes', $like->likeID, $likeable->getUserID());
+                               if ($likeValue == Like::LIKE && $likeable->getUserID()) {
+                                       UserActivityPointHandler::getInstance()->fireEvent('com.woltlab.wcf.like.activityPointEvent.receivedLikes', $like->likeID, $likeable->getUserID());
+                                       $likeable->sendNotification($like);
+                               }
                        }
                        else {
                                $likeEditor = new LikeEditor($like);
@@ -295,8 +298,13 @@ class LikeHandler extends SingletonFactory {
                                ));
                                
                                if ($likeable->getUserID()) {
-                                       if ($likeValue == Like::DISLIKE) UserActivityPointHandler::getInstance()->removeEvents('com.woltlab.wcf.like.activityPointEvent.receivedLikes', array($likeable->getUserID() => 1));
-                                       else UserActivityPointHandler::getInstance()->fireEvent('com.woltlab.wcf.like.activityPointEvent.receivedLikes', $like->likeID, $likeable->getUserID());
+                                       if ($likeValue == Like::DISLIKE) {
+                                               UserActivityPointHandler::getInstance()->removeEvents('com.woltlab.wcf.like.activityPointEvent.receivedLikes', array($likeable->getUserID() => 1));
+                                       }
+                                       else {
+                                               UserActivityPointHandler::getInstance()->fireEvent('com.woltlab.wcf.like.activityPointEvent.receivedLikes', $like->likeID, $likeable->getUserID());
+                                               $likeable->sendNotification($like);
+                                       }
                                }
                        }
                        
index 344964ed6ad45a106e62b23fc648268a075bd0f7..c1fb78971ea87774614a0d4f83b107622fa9640c 100644 (file)
@@ -143,14 +143,14 @@ class UserNotificationHandler extends SingletonFactory {
                                $notificationIDs[] = $row['notificationID'];
                        }
                        
-                       if (!empty($notificationIDs)) {
-                               // filter array of existing notifications and remove values which do not have a notification from this author yet (inverse logic!)
-                               foreach ($notifications as $userID => $notificationID) {
-                                       if (!in_array($notificationID, $notificationIDs)) {
-                                               unset($notifications[$userID]);
-                                       }
+                       // filter array of existing notifications and remove values which do not have a notification from this author yet (inverse logic!)
+                       foreach ($notifications as $userID => $notificationID) {
+                               if (!in_array($notificationID, $notificationIDs)) {
+                                       unset($notifications[$userID]);
                                }
-                               
+                       }
+                       
+                       if (!empty($notificationIDs)) { 
                                // update trigger count
                                $sql = "UPDATE  wcf".WCF_N."_user_notification
                                        SET     timesTriggered = timesTriggered + ?
@@ -188,6 +188,7 @@ class UserNotificationHandler extends SingletonFactory {
                                        'objectID' => $notificationObject->getObjectID(),
                                        'eventHash' => $event->getEventHash(),
                                        'packageID' => $objectTypeObject->packageID,
+                                       'mailNotified' => ($event->supportsEmailNotification() ? 0 : 1),
                                        'time' => TIME_NOW,
                                        'additionalData' => serialize($additionalData)
                                ),
@@ -208,10 +209,12 @@ class UserNotificationHandler extends SingletonFactory {
                        $notifications = $result['returnValues'];
                        
                        // send notifications
-                       foreach ($recipients as $recipient) {
-                               if ($recipient->mailNotificationType == 'instant') {
-                                       if (isset($notifications[$recipient->userID]) && $notifications[$recipient->userID]['isNew']) {
-                                               $this->sendInstantMailNotification($notifications[$recipient->userID]['object'], $recipient, $event);
+                       if ($event->supportsEmailNotification()) {
+                               foreach ($recipients as $recipient) {
+                                       if ($recipient->mailNotificationType == 'instant') {
+                                               if (isset($notifications[$recipient->userID]) && $notifications[$recipient->userID]['isNew']) {
+                                                       $this->sendInstantMailNotification($notifications[$recipient->userID]['object'], $recipient, $event);
+                                               }
                                        }
                                }
                        }
index cbd224527741cff18b2c76da500dd727b50635cd..d188339c09ac16fa97976b90073583d7be9d1807 100644 (file)
@@ -225,4 +225,11 @@ abstract class AbstractUserNotificationEvent extends DatabaseObjectDecorator imp
                
                return WCF::getLanguage()->get('wcf.date.period.older');
        }
+       
+       /**
+        * @see \wcf\system\user\notification\event\IUserNotificationEvent::supportsEmailNotification()
+        */
+       public function supportsEmailNotification() {
+               return true;
+       }
 }
index f883b42739dd97a5eda90817363c1d1a55f9d3fa..c77fa8f11d02e2cf4040c0476dd6d1b9fe6c1b4c 100644 (file)
@@ -119,4 +119,11 @@ interface IUserNotificationEvent extends IDatabaseObjectProcessor {
         * @return      boolean
         */
        public function isStackable();
+       
+       /**
+        * Returns true if this notification event supports email notifications.
+        * 
+        * @return      boolean
+        */
+       public function supportsEmailNotification();
 }
diff --git a/wcfsetup/install/files/lib/system/user/notification/event/UserProfileCommentLikeUserNotificationEvent.class.php b/wcfsetup/install/files/lib/system/user/notification/event/UserProfileCommentLikeUserNotificationEvent.class.php
new file mode 100644 (file)
index 0000000..751d278
--- /dev/null
@@ -0,0 +1,93 @@
+<?php
+namespace wcf\system\user\notification\event;
+use wcf\data\user\User;
+use wcf\system\request\LinkHandler;
+use wcf\system\user\notification\event\AbstractUserNotificationEvent;
+use wcf\system\WCF;
+
+/**
+ * User notification event for profile commment likes.
+ * 
+ * @author     Alexander Ebert
+ * @copyright  2001-2014 WoltLab GmbH
+ * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package    com.woltlab.wcf
+ * @subpackage system.user.notification.event
+ * @category   Community Framework
+ */
+class UserProfileCommentLikeUserNotificationEvent extends AbstractUserNotificationEvent {
+       /**
+        * @see \wcf\system\user\notification\event\AbstractUserNotificationEvent::$stackable
+        */
+       protected $stackable = true;
+       
+       /**
+        * @see \wcf\system\user\notification\event\IUserNotificationEvent::getTitle()
+        */
+       public function getTitle() {
+               $count = count($this->getAuthors());
+               if ($count > 1) {
+                       return $this->getLanguage()->getDynamicVariable('wcf.user.notification.comment.like.title.stacked', array(
+                               'count' => $count,
+                               'timesTriggered' => $this->timesTriggered
+                       ));
+               }
+               
+               return $this->getLanguage()->get('wcf.user.notification.comment.like.title');
+       }
+       
+       /**
+        * @see \wcf\system\user\notification\event\IUserNotificationEvent::getMessage()
+        */
+       public function getMessage() {
+               $authors = array_values($this->getAuthors());
+               $count = count($authors);
+               $owner = null;
+               if ($this->additionalData['objectID'] != WCF::getUser()->userID) {
+                       $owner = new User($this->additionalData['objectID']);
+               }
+               
+               if ($count > 1) {
+                       return $this->getLanguage()->getDynamicVariable('wcf.user.notification.comment.like.message.stacked', array(
+                               'author' => $this->author,
+                               'authors' => $authors,
+                               'comment' => $this->userNotificationObject,
+                               'count' => $count,
+                               'others' => max($count - 1, 0),
+                               'owner' => $owner
+                       ));
+               }
+               
+               return $this->getLanguage()->getDynamicVariable('wcf.user.notification.comment.like.message', array(
+                       'author' => $this->author,
+                       'comment' => $this->userNotificationObject,
+                       'owner' => $owner
+               ));
+       }
+       
+       /**
+        * @see \wcf\system\user\notification\event\IUserNotificationEvent::getEmailMessage()
+        */
+       public function getEmailMessage($notificationType = 'instant') { /* not supported */ }
+       
+       /**
+        * @see \wcf\system\user\notification\event\IUserNotificationEvent::getLink()
+        */
+       public function getLink() {
+               return LinkHandler::getInstance()->getLink('User', array('object' => WCF::getUser()), '#wall');
+       }
+       
+       /**
+        * @see \wcf\system\user\notification\event\IUserNotificationEvent::getEventHash()
+        */
+       public function getEventHash() {
+               return sha1($this->eventID . '-' . $this->additionalData['objectID']);
+       }
+       
+       /**
+        * @see \wcf\system\user\notification\event\IUserNotificationEvent::supportsEmailNotification()
+        */
+       public function supportsEmailNotification() {
+               return false;
+       }
+}
diff --git a/wcfsetup/install/files/lib/system/user/notification/event/UserProfileCommentResponseLikeUserNotificationEvent.class.php b/wcfsetup/install/files/lib/system/user/notification/event/UserProfileCommentResponseLikeUserNotificationEvent.class.php
new file mode 100644 (file)
index 0000000..c8c0779
--- /dev/null
@@ -0,0 +1,96 @@
+<?php
+namespace wcf\system\user\notification\event;
+use wcf\data\user\User;
+use wcf\system\request\LinkHandler;
+use wcf\system\user\notification\event\AbstractUserNotificationEvent;
+use wcf\system\WCF;
+
+/**
+ * User notification event for profile commment response likes.
+ * 
+ * @author     Alexander Ebert
+ * @copyright  2001-2014 WoltLab GmbH
+ * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package    com.woltlab.wcf
+ * @subpackage system.user.notification.event
+ * @category   Community Framework
+ */
+class UserProfileCommentResponseLikeUserNotificationEvent extends AbstractUserNotificationEvent {
+       /**
+        * @see \wcf\system\user\notification\event\AbstractUserNotificationEvent::$stackable
+        */
+       protected $stackable = true;
+       
+       /**
+        * @see \wcf\system\user\notification\event\IUserNotificationEvent::getTitle()
+        */
+       public function getTitle() {
+               $count = count($this->getAuthors());
+               if ($count > 1) {
+                       return $this->getLanguage()->getDynamicVariable('wcf.user.notification.commentResponse.like.title.stacked', array(
+                               'count' => $count,
+                               'timesTriggered' => $this->timesTriggered
+                       ));
+               }
+               
+               return $this->getLanguage()->get('wcf.user.notification.commentResponse.like.title');
+       }
+       
+       /**
+        * @see \wcf\system\user\notification\event\IUserNotificationEvent::getMessage()
+        */
+       public function getMessage() {
+               $authors = array_values($this->getAuthors());
+               $count = count($authors);
+               $commentUser = $owner = null;
+               if ($this->additionalData['objectID'] != WCF::getUser()->userID) {
+                       $owner = new User($this->additionalData['objectID']);
+               }
+               if ($this->additionalData['commentUserID'] != WCF::getUser()->userID) {
+                       $commentUser = new User($this->additionalData['commentUserID']);
+               }
+               
+               if ($count > 1) {
+                       return $this->getLanguage()->getDynamicVariable('wcf.user.notification.commentResponse.like.message.stacked', array(
+                               'author' => $this->author,
+                               'authors' => $authors,
+                               'commentUser' => $commentUser,
+                               'count' => $count,
+                               'others' => max($count - 1, 0),
+                               'owner' => $owner
+                       ));
+               }
+               
+               return $this->getLanguage()->getDynamicVariable('wcf.user.notification.commentResponse.like.message', array(
+                       'author' => $this->author,
+                       'comment' => $this->userNotificationObject,
+                       'owner' => $owner
+               ));
+       }
+       
+       /**
+        * @see \wcf\system\user\notification\event\IUserNotificationEvent::getEmailMessage()
+        */
+       public function getEmailMessage($notificationType = 'instant') { /* not supported */ }
+       
+       /**
+        * @see \wcf\system\user\notification\event\IUserNotificationEvent::getLink()
+        */
+       public function getLink() {
+               return LinkHandler::getInstance()->getLink('User', array('object' => WCF::getUser()), '#wall');
+       }
+       
+       /**
+        * @see \wcf\system\user\notification\event\IUserNotificationEvent::getEventHash()
+        */
+       public function getEventHash() {
+               return sha1($this->eventID . '-' . $this->additionalData['commentID']);
+       }
+       
+       /**
+        * @see \wcf\system\user\notification\event\IUserNotificationEvent::supportsEmailNotification()
+        */
+       public function supportsEmailNotification() {
+               return false;
+       }
+}
diff --git a/wcfsetup/install/files/lib/system/user/notification/object/CommentLikeUserNotificationObject.class.php b/wcfsetup/install/files/lib/system/user/notification/object/CommentLikeUserNotificationObject.class.php
new file mode 100644 (file)
index 0000000..9ce13fa
--- /dev/null
@@ -0,0 +1,41 @@
+<?php
+namespace wcf\system\user\notification\object;
+use wcf\data\DatabaseObjectDecorator;
+
+/**
+ * Notification object for comment likes.
+ * 
+ * @author     Alexander Ebert
+ * @copyright  2001-2014 WoltLab GmbH
+ * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package    com.woltlab.wcf
+ * @subpackage system.user.notification.object
+ * @category   Community Framework
+ */
+class CommentLikeUserNotificationObject extends DatabaseObjectDecorator implements IUserNotificationObject {
+       /**
+        * @see \wcf\data\DatabaseObjectDecorator::$baseClass
+        */
+       protected static $baseClass = 'wcf\data\like\Like';
+       
+       /**
+        * @see \wcf\system\user\notification\object\IUserNotificationObject::getTitle()
+        */
+       public function getTitle() {
+               return '';
+       }
+       
+       /**
+        * @see \wcf\system\user\notification\object\IUserNotificationObject::getURL()
+        */
+       public function getURL() {
+               return '';
+       }
+       
+       /**
+        * @see \wcf\system\user\notification\object\IUserNotificationObject::getAuthorID()
+        */
+       public function getAuthorID() {
+               return $this->userID;
+       }
+}
diff --git a/wcfsetup/install/files/lib/system/user/notification/object/CommentResponseLikeUserNotificationObject.class.php b/wcfsetup/install/files/lib/system/user/notification/object/CommentResponseLikeUserNotificationObject.class.php
new file mode 100644 (file)
index 0000000..e57e6d9
--- /dev/null
@@ -0,0 +1,41 @@
+<?php
+namespace wcf\system\user\notification\object;
+use wcf\data\DatabaseObjectDecorator;
+
+/**
+ * Notification object for comment response likes.
+ * 
+ * @author     Alexander Ebert
+ * @copyright  2001-2014 WoltLab GmbH
+ * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package    com.woltlab.wcf
+ * @subpackage system.user.notification.object
+ * @category   Community Framework
+ */
+class CommentResponseLikeUserNotificationObject extends DatabaseObjectDecorator implements IUserNotificationObject {
+       /**
+        * @see \wcf\data\DatabaseObjectDecorator::$baseClass
+        */
+       protected static $baseClass = 'wcf\data\like\Like';
+       
+       /**
+        * @see \wcf\system\user\notification\object\IUserNotificationObject::getTitle()
+        */
+       public function getTitle() {
+               return '';
+       }
+       
+       /**
+        * @see \wcf\system\user\notification\object\IUserNotificationObject::getURL()
+        */
+       public function getURL() {
+               return '';
+       }
+       
+       /**
+        * @see \wcf\system\user\notification\object\IUserNotificationObject::getAuthorID()
+        */
+       public function getAuthorID() {
+               return $this->userID;
+       }
+}
diff --git a/wcfsetup/install/files/lib/system/user/notification/object/type/UserProfileCommentLikeUserNotificationObjectType.class.php b/wcfsetup/install/files/lib/system/user/notification/object/type/UserProfileCommentLikeUserNotificationObjectType.class.php
new file mode 100644 (file)
index 0000000..f8856b0
--- /dev/null
@@ -0,0 +1,44 @@
+<?php
+namespace wcf\system\user\notification\object\type;
+use wcf\system\WCF;
+
+/**
+ * Represents a comment notification object type for likes.
+ * 
+ * @author     Alexander Ebert
+ * @copyright  2001-2014 WoltLab GmbH
+ * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package    com.woltlab.wcf
+ * @subpackage system.user.notification.object.type
+ * @category   Community Framework
+ */
+class UserProfileCommentLikeUserNotificationObjectType extends AbstractUserNotificationObjectType implements ICommentUserNotificationObjectType {
+       /**
+        * @see \wcf\system\user\notification\object\type\AbstractUserNotificationObjectType::$decoratorClassName
+        */
+       protected static $decoratorClassName = 'wcf\system\user\notification\object\CommentLikeUserNotificationObject';
+       
+       /**
+        * @see \wcf\system\user\notification\object\type\AbstractUserNotificationObjectType::$objectClassName
+        */
+       protected static $objectClassName = 'wcf\data\like\Like';
+       
+       /**
+        * @see \wcf\system\user\notification\object\type\AbstractUserNotificationObjectType::$objectListClassName
+        */
+       protected static $objectListClassName = 'wcf\data\like\LikeList';
+       
+       /**
+        * @see \wcf\system\user\notification\object\type\ICommentUserNotificationObjectType::getOwnerID()
+        */
+       public function getOwnerID($objectID) {
+               $sql = "SELECT  objectUserID
+                       FROM    wcf".WCF_N."_like
+                       WHERE   likeID = ?";
+               $statement = WCF::getDB()->prepareStatement($sql);
+               $statement->execute(array($objectID));
+               $row = $statement->fetchArray();
+               
+               return ($row ? $row['objectUserID'] : 0);
+       }
+}
diff --git a/wcfsetup/install/files/lib/system/user/notification/object/type/UserProfileCommentResponseLikeUserNotificationObjectType.class.php b/wcfsetup/install/files/lib/system/user/notification/object/type/UserProfileCommentResponseLikeUserNotificationObjectType.class.php
new file mode 100644 (file)
index 0000000..33c45b1
--- /dev/null
@@ -0,0 +1,29 @@
+<?php
+namespace wcf\system\user\notification\object\type;
+
+/**
+ * Represents a comment response notification object type for likes.
+ * 
+ * @author     Alexander Ebert
+ * @copyright  2001-2014 WoltLab GmbH
+ * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package    com.woltlab.wcf
+ * @subpackage system.user.notification.object.type
+ * @category   Community Framework
+ */
+class UserProfileCommentResponseLikeUserNotificationObjectType extends AbstractUserNotificationObjectType {
+       /**
+        * @see \wcf\system\user\notification\object\type\AbstractUserNotificationObjectType::$decoratorClassName
+        */
+       protected static $decoratorClassName = 'wcf\system\user\notification\object\CommentResponseUserNotificationObject';
+       
+       /**
+        * @see \wcf\system\user\notification\object\type\AbstractUserNotificationObjectType::$objectClassName
+        */
+       protected static $objectClassName = 'wcf\data\comment\response\CommentResponse';
+       
+       /**
+        * @see \wcf\system\user\notification\object\type\AbstractUserNotificationObjectType::$objectListClassName
+        */
+       protected static $objectListClassName = 'wcf\data\comment\response\CommentResponseList';
+}
index ae2aa6ae0aaade01669e1ae395be9dd4a15d94c9..52c2e61f64f7d9b2d84af829ec2a55370989daee 100644 (file)
@@ -2851,6 +2851,7 @@ Möchten Sie diese E-Mail-Benachrichtigung in Zukunft nicht mehr erhalten, könn
                <item name="wcf.user.notification.mailNotificationType.none"><![CDATA[Keine E-Mail-Benachrichtigung]]></item>
                <item name="wcf.user.notification.mailNotificationType.instant"><![CDATA[Sofortige E-Mail-Benachrichtigung]]></item>
                <item name="wcf.user.notification.mailNotificationType.daily"><![CDATA[Tägliche E-Mail-Benachrichtigung]]></item>
+               <item name="wcf.user.notification.mailNotificationType.notSupported"><![CDATA[E-Mail-Benachrichtigungen werden nicht unterstützt.]]></item>
                <item name="wcf.user.notification.markAllAsConfirmed"><![CDATA[Alle als gelesen markieren]]></item>
                <item name="wcf.user.notification.markAllAsConfirmed.confirmMessage"><![CDATA[Wollen Sie wirklich alle Benachrichtigungen als gelesen markieren?]]></item>
                <item name="wcf.user.notification.markAsConfirmed"><![CDATA[Alls gelesen markieren]]></item>
@@ -2864,6 +2865,10 @@ Möchten Sie diese E-Mail-Benachrichtigung in Zukunft nicht mehr erhalten, könn
                <item name="wcf.user.notification.comment.title.stacked"><![CDATA[{#$timesTriggered} neue Kommentare (Pinnwand)]]></item>
                <item name="wcf.user.notification.comment.message"><![CDATA[Hat einen Kommentar an Ihrer Pinnwand verfasst.]]></item>
                <item name="wcf.user.notification.comment.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 {#$count} weitere{/if} haben Kommentare an <a href="{link controller='User' object=$__wcf->getUser()}#wall{/link}">Ihrer Pinnwand</a> verfasst.]]></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 Ihr Kommentar (Pinnwand)]]></item>
+               <item name="wcf.user.notification.comment.like.message"><![CDATA[Gefällt Ihr Kommentar an {if $owner === null}Ihrer Pinnwand{else}der Pinnwand von {$owner->username}{/if}.]]></item>
+               <item name="wcf.user.notification.comment.like.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 {#$count} weiteren{/if} gefällt Ihr Kommentar an {if $owner === null}<a href="{link controller='User' object=$__wcf->getUser()}#wall{/link}">Ihrer Pinnwand</a>{else}der <a href="{link controller='User' object=$owner}#wall{/link}">Pinnwand von {$owner->username}</a>{/if}.]]></item>
                <item name="wcf.user.notification.comment.mail"><![CDATA[{@$author->username} hat einen Kommentar an Ihrer Pinnwand verfasst:
 {if $notificationType == 'instant'}
 ---------------------------------
@@ -2874,6 +2879,10 @@ Möchten Sie diese E-Mail-Benachrichtigung in Zukunft nicht mehr erhalten, könn
                <item name="wcf.user.notification.commentResponse.title.stacked"><![CDATA[{#$timesTriggered} neue Antworten (Pinnwand)]]></item>
                <item name="wcf.user.notification.commentResponse.message"><![CDATA[Hat eine Antwort zu Ihrem Kommentar an der Pinnwand von {$owner->username} verfasst.]]></item>
                <item name="wcf.user.notification.commentResponse.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 {#$count} weitere{/if} haben auf Ihren Kommentar an der <a href="{link controller='User' object=$owner}#wall{/link}">Pinnwand von {$owner->username}</a> geantwortet.]]></item>
+               <item name="wcf.user.notification.commentResponse.like.title"><![CDATA[Gefällt die Antwort auf einen Kommentar (Pinnwand)]]></item>
+               <item name="wcf.user.notification.commentResponse.like.title.stacked"><![CDATA[{#$count} Benutzern gefällt Ihre Antwort auf einen Kommentar (Pinnwand)]]></item>
+               <item name="wcf.user.notification.commentResponse.like.message"><![CDATA[Gefällt Ihre Antwort auf einen Kommentar an {if $owner === null}Ihrer Pinnwand{else}der Pinnwand von {$owner->username}{/if}.]]></item>
+               <item name="wcf.user.notification.commentResponse.like.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 {#$count} weiteren{/if} gefällt Ihre Antwort auf einen Kommentar an {if $owner === null}<a href="{link controller='User' object=$__wcf->getUser()}#wall{/link}">Ihrer Pinnwand</a>{else}der <a href="{link controller='User' object=$owner}#wall{/link}">Pinnwand von {$owner->username}</a>{/if}.]]></item>
                <item name="wcf.user.notification.commentResponse.mail"><![CDATA[{@$author->username} hat eine Antwort zu Ihrem Kommentar an der Pinnwand von "{@$owner->username}" verfasst:
 {if $notificationType == 'instant'}
 ---------------------------------
index ca69f9967e8c3157283e902103cd07bea9be2860..63031369afafc02b00c24ede1746e0021a73c718 100644 (file)
@@ -2706,6 +2706,7 @@ If you do not want to receive further email notifications for this event, you ca
                <item name="wcf.user.notification.mailNotificationType.none"><![CDATA[No Email Notification]]></item>
                <item name="wcf.user.notification.mailNotificationType.instant"><![CDATA[Instant Email Notification]]></item>
                <item name="wcf.user.notification.mailNotificationType.daily"><![CDATA[Daily Email Notification]]></item>
+               <item name="wcf.user.notification.mailNotificationType.notSupported"><![CDATA[Email Notifications are not supported.]]></item>
                <item name="wcf.user.notification.markAllAsConfirmed"><![CDATA[Mark All as Read]]></item>
                <item name="wcf.user.notification.markAllAsConfirmed.confirmMessage"><![CDATA[Do you really want to mark all notifications as read?]]></item>
                <item name="wcf.user.notification.markAsConfirmed"><![CDATA[Mark as Read]]></item>
@@ -2719,6 +2720,10 @@ If you do not want to receive further email notifications for this event, you ca
                <item name="wcf.user.notification.comment.title.stacked"><![CDATA[{#$timesTriggered} new comments (Wall)]]></item>
                <item name="wcf.user.notification.comment.message"><![CDATA[Wrote a comment on your wall.]]></item>
                <item name="wcf.user.notification.comment.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 {#$count} others{/if} wrote comments on <a href="{link controller='User' object=$__wcf->getUser()}#wall{/link}">your wall</a>.]]></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[Likes your comment on {if $owner === null}your wall{else}{$owner->username}’s wall{/if}.]]></item>
+               <item name="wcf.user.notification.comment.like.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 {#$count} others{/if} like 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>
                <item name="wcf.user.notification.comment.mail"><![CDATA[{@$author->username} wrote a comment on your wall:
 {if $notificationType == 'instant'}
 ---------------------------------
@@ -2729,6 +2734,10 @@ If you do not want to receive further email notifications for this event, you ca
                <item name="wcf.user.notification.commentResponse.title.stacked"><![CDATA[{#$timesTriggered} new replies (Wall)]]></item>
                <item name="wcf.user.notification.commentResponse.message"><![CDATA[Wrote a reply to your comment on {$owner->username}’s wall.]]></item>
                <item name="wcf.user.notification.commentResponse.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 {#$count} others{/if} replied to your comment on <a href="{link controller='User' object=$owner}#wall{/link}">{$owner->username}’s wall</a>.]]></item>
+               <item name="wcf.user.notification.commentResponse.like.title"><![CDATA[Likes your reply to a comment (Wall)]]></item>
+               <item name="wcf.user.notification.commentResponse.like.title.stacked"><![CDATA[{#$count} users like your reply to a comment (Wall)]]></item>
+               <item name="wcf.user.notification.commentResponse.like.message"><![CDATA[Likes your reply to a comment on {if $owner === null}your wall{else}{$owner->username}’s wall{/if}.]]></item>
+               <item name="wcf.user.notification.commentResponse.like.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 {#$count} others{/if} like your reply to a 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>
                <item name="wcf.user.notification.commentResponse.mail"><![CDATA[{@$author->username} wrote a reply to your comment on {@$owner->username}’s wall:
 {if $notificationType == 'instant'}
 ---------------------------------