Add flag for comment response, to mark them compatible with the reaction system
authorJoshua Rüsweg <josh@bastelstu.be>
Sun, 1 Jul 2018 18:28:25 +0000 (20:28 +0200)
committerJoshua Rüsweg <josh@bastelstu.be>
Sun, 1 Jul 2018 18:28:25 +0000 (20:28 +0200)
See comment 2faf60e677515153e02fc5cbdc4e4dd7615812e1
See #2508

wcfsetup/install/files/lib/data/comment/response/LikeableCommentResponse.class.php

index 0b1fc8dc80ac371ae572a588eb85735678413a5d..8a6c398434b7c082fac14a86ed4dc5ac1cef02fb 100644 (file)
@@ -4,6 +4,7 @@ namespace wcf\data\comment\response;
 use wcf\data\comment\Comment;
 use wcf\data\like\object\AbstractLikeObject;
 use wcf\data\like\Like;
+use wcf\data\reaction\object\IReactionObject;
 use wcf\system\comment\CommentHandler;
 use wcf\system\user\notification\object\LikeUserNotificationObject;
 use wcf\system\user\notification\UserNotificationHandler;
@@ -20,7 +21,7 @@ use wcf\system\WCF;
  * @method     CommentResponse         getDecoratedObject()
  * @mixin      CommentResponse
  */
-class LikeableCommentResponse extends AbstractLikeObject {
+class LikeableCommentResponse extends AbstractLikeObject implements IReactionObject {
        /**
         * @inheritDoc
         */
@@ -53,7 +54,7 @@ class LikeableCommentResponse extends AbstractLikeObject {
        public function sendNotification(Like $like) {
                $comment = new Comment($this->getDecoratedObject()->commentID);
                $objectType = CommentHandler::getInstance()->getObjectType($comment->objectTypeID);
-               if (UserNotificationHandler::getInstance()->getObjectTypeID($objectType->objectType.'.response.like.notification')) {
+               if (UserNotificationHandler::getInstance()->getObjectTypeID($objectType->objectType.'.response.like.notification') && UserNotificationHandler::getInstance()->getObjectTypeProcessor($objectType->objectType.'.response.like.notification')->supportReactions) {
                        if ($this->userID != WCF::getUser()->userID) {
                                $notificationObject = new LikeUserNotificationObject($like);
                                UserNotificationHandler::getInstance()->fireEvent(