Use general LikeUserNotificationObject(Type) classes
authorMatthias Schmidt <gravatronics@live.com>
Sun, 27 Jul 2014 09:18:17 +0000 (11:18 +0200)
committerMatthias Schmidt <gravatronics@live.com>
Sun, 27 Jul 2014 09:18:17 +0000 (11:18 +0200)
com.woltlab.wcf/objectType.xml
wcfsetup/install/files/lib/data/comment/LikeableComment.class.php
wcfsetup/install/files/lib/data/comment/response/LikeableCommentResponse.class.php
wcfsetup/install/files/lib/system/user/notification/object/CommentLikeUserNotificationObject.class.php [deleted file]
wcfsetup/install/files/lib/system/user/notification/object/CommentResponseLikeUserNotificationObject.class.php [deleted file]
wcfsetup/install/files/lib/system/user/notification/object/LikeUserNotificationObject.class.php [new file with mode: 0644]
wcfsetup/install/files/lib/system/user/notification/object/type/LikeUserNotificationObjectType.class.php [new file with mode: 0644]
wcfsetup/install/files/lib/system/user/notification/object/type/UserProfileCommentLikeUserNotificationObjectType.class.php [deleted file]
wcfsetup/install/files/lib/system/user/notification/object/type/UserProfileCommentResponseLikeUserNotificationObjectType.class.php [deleted file]

index 0080bf9e0c451f285483c49bfc9970aa9df24ad1..59665ac26dc8b3e62ebada56409b51de606983e0 100644 (file)
                <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>
+                       <classname><![CDATA[wcf\system\user\notification\object\type\LikeUserNotificationObjectType]]></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>
+                       <classname><![CDATA[wcf\system\user\notification\object\type\LikeUserNotificationObjectType]]></classname>
                        <category>com.woltlab.wcf.user</category>
                </type>
                
index 458d3a62bcb8473abcdbfa614253365894021a1c..c9b4c66b0835084223852f44431f7f7b061cbba7 100644 (file)
@@ -4,7 +4,7 @@ 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\object\LikeUserNotificationObject;
 use wcf\system\user\notification\UserNotificationHandler;
 use wcf\system\WCF;
 
@@ -64,7 +64,7 @@ class LikeableComment extends AbstractLikeObject {
                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);
+                               $notificationObject = new LikeUserNotificationObject($like);
                                UserNotificationHandler::getInstance()->fireEvent('like', $objectType->objectType.'.like.notification', $notificationObject, array($this->userID), array(
                                        'objectID' => $this->object->objectID,
                                        'objectOwnerID' => $this->userID
index bc03823b07e3b7adf2a0337ef7a1c6762c9f88e7..8b221925eef5c1c5eb53fb4b0773889c132572b0 100644 (file)
@@ -5,7 +5,7 @@ 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\object\LikeUserNotificationObject;
 use wcf\system\user\notification\UserNotificationHandler;
 use wcf\system\WCF;
 
@@ -66,7 +66,7 @@ class LikeableCommentResponse extends AbstractLikeObject {
                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);
+                               $notificationObject = new LikeUserNotificationObject($like);
                                UserNotificationHandler::getInstance()->fireEvent('like', $objectType->objectType.'.response.like.notification', $notificationObject, array($this->userID), array(
                                        'commentID' => $comment->commentID,
                                        'commentUserID' => $comment->userID,
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
deleted file mode 100644 (file)
index 9ce13fa..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-<?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
deleted file mode 100644 (file)
index e57e6d9..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-<?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/LikeUserNotificationObject.class.php b/wcfsetup/install/files/lib/system/user/notification/object/LikeUserNotificationObject.class.php
new file mode 100644 (file)
index 0000000..80ed300
--- /dev/null
@@ -0,0 +1,41 @@
+<?php
+namespace wcf\system\user\notification\object;
+use wcf\data\DatabaseObjectDecorator;
+
+/**
+ * User notification object implementation 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
+ * @category   Community Framework
+ */
+class LikeUserNotificationObject 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/LikeUserNotificationObjectType.class.php b/wcfsetup/install/files/lib/system/user/notification/object/type/LikeUserNotificationObjectType.class.php
new file mode 100644 (file)
index 0000000..9e85c0c
--- /dev/null
@@ -0,0 +1,30 @@
+<?php
+namespace wcf\system\user\notification\object\type;
+use wcf\system\WCF;
+
+/**
+ * User notification object type implementation 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 LikeUserNotificationObjectType extends AbstractUserNotificationObjectType {
+       /**
+        * @see \wcf\system\user\notification\object\type\AbstractUserNotificationObjectType::$decoratorClassName
+        */
+       protected static $decoratorClassName = 'wcf\system\user\notification\object\LikeUserNotificationObject';
+       
+       /**
+        * @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';
+}
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
deleted file mode 100644 (file)
index f8856b0..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-<?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
deleted file mode 100644 (file)
index 33c45b1..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-<?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';
-}