From 3a702e481ea2d52664e9ee55296adbc6a95af6aa Mon Sep 17 00:00:00 2001 From: Marcel Werk Date: Sun, 24 Nov 2013 15:05:19 +0100 Subject: [PATCH] Fixed like counter issues --- .../files/lib/system/like/LikeHandler.class.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/wcfsetup/install/files/lib/system/like/LikeHandler.class.php b/wcfsetup/install/files/lib/system/like/LikeHandler.class.php index dd2d848696..3cab98584c 100644 --- a/wcfsetup/install/files/lib/system/like/LikeHandler.class.php +++ b/wcfsetup/install/files/lib/system/like/LikeHandler.class.php @@ -294,7 +294,10 @@ class LikeHandler extends SingletonFactory { 'likeValue' => $likeValue )); - if ($likeValue == Like::DISLIKE) UserActivityPointHandler::getInstance()->removeEvents('com.woltlab.wcf.like.activityPointEvent.receivedLikes', array($user->userID => 1)); + 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()); + } } // update object's like counter @@ -320,7 +323,7 @@ class LikeHandler extends SingletonFactory { * * @param \wcf\data\like\Like $like * @param \wcf\data\like\object\ILikeObject $likeable - * @param \wcf\data\like\object\LikeObject $likeObject + * @param \wcf\data\like\object\LikeObject $likeObject * @param \wcf\data\user\User $user * @return array */ @@ -381,9 +384,9 @@ class LikeHandler extends SingletonFactory { $userEditor->updateCounters(array( 'likesReceived' => -1 )); + + UserActivityPointHandler::getInstance()->removeEvents('com.woltlab.wcf.like.activityPointEvent.receivedLikes', array($likeable->getUserID() => 1)); } - - UserActivityPointHandler::getInstance()->removeEvents('com.woltlab.wcf.like.activityPointEvent.receivedLikes', array($likeable->getUserID() => 1)); } // update object's like counter -- 2.20.1