From c77ae4be25138e237b595d3270c2cf8012d061b4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Joshua=20R=C3=BCsweg?= Date: Wed, 25 Jul 2018 15:10:40 +0200 Subject: [PATCH] Add only reaction activity event if the object support these See #2508 --- com.woltlab.wcf/objectType.xml | 1 + .../lib/system/reaction/ReactionHandler.class.php | 14 ++++++++------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/com.woltlab.wcf/objectType.xml b/com.woltlab.wcf/objectType.xml index 970252a156..4b91e84ed2 100644 --- a/com.woltlab.wcf/objectType.xml +++ b/com.woltlab.wcf/objectType.xml @@ -49,6 +49,7 @@ com.woltlab.wcf.likeableArticle.recentActivityEvent com.woltlab.wcf.user.recentActivityEvent wcf\system\user\activity\event\LikeableArticleUserActivityEvent + 1 com.woltlab.wcf.articleComment.recentActivityEvent diff --git a/wcfsetup/install/files/lib/system/reaction/ReactionHandler.class.php b/wcfsetup/install/files/lib/system/reaction/ReactionHandler.class.php index 4fd3df72a1..9aaa09e0c2 100644 --- a/wcfsetup/install/files/lib/system/reaction/ReactionHandler.class.php +++ b/wcfsetup/install/files/lib/system/reaction/ReactionHandler.class.php @@ -304,13 +304,15 @@ class ReactionHandler extends SingletonFactory { // update recent activity if (UserActivityEventHandler::getInstance()->getObjectTypeID($likeable->getObjectType()->objectType.'.recentActivityEvent')) { - if ($like->likeID) { - UserActivityEventHandler::getInstance()->removeEvent($likeable->getObjectType()->objectType.'.recentActivityEvent', $likeable->getObjectID(), $user->userID); - } + $objectType = ObjectTypeCache::getInstance()->getObjectTypeByName('com.woltlab.wcf.user.recentActivityEvent', $likeable->getObjectType()->objectType.'.recentActivityEvent'); - UserActivityEventHandler::getInstance()->fireEvent($likeable->getObjectType()->objectType.'.recentActivityEvent', $likeable->getObjectID(), $likeable->getLanguageID(), $user->userID, TIME_NOW, [ - 'reactionType' => $reaction - ]); + if ($objectType->supportReactions) { + if ($like->likeID) { + UserActivityEventHandler::getInstance()->removeEvent($likeable->getObjectType()->objectType . '.recentActivityEvent', $likeable->getObjectID(), $user->userID); + } + + UserActivityEventHandler::getInstance()->fireEvent($likeable->getObjectType()->objectType . '.recentActivityEvent', $likeable->getObjectID(), $likeable->getLanguageID(), $user->userID, TIME_NOW, ['reactionType' => $reaction]); + } } WCF::getDB()->commitTransaction(); -- 2.20.1