Incorrect deduction of activity points for revoked reactions
authorAlexander Ebert <ebert@woltlab.com>
Sun, 5 Jan 2020 21:38:19 +0000 (22:38 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Sun, 5 Jan 2020 21:38:19 +0000 (22:38 +0100)
wcfsetup/install/files/lib/system/reaction/ReactionHandler.class.php

index 7d5ad8ef91c97bef3bc8936dac9b9785599c8e4d..ee8b4b57bac826983dede87cfafc7334d41c4cfa 100644 (file)
@@ -652,9 +652,12 @@ class ReactionHandler extends SingletonFactory {
                $likeList->readObjects();
                
                if (count($likeList)) {
-                       $likeData = [];
+                       $activityPoints = $likeData = [];
                        foreach ($likeList as $like) {
                                $likeData[$like->likeID] = $like->userID;
+                               
+                               if (!isset($activityPoints[$like->userID])) $activityPoints[$like->userID] = 0;
+                               $activityPoints[$like->userID]++;
                        }
                        
                        // delete like notifications
@@ -668,7 +671,7 @@ class ReactionHandler extends SingletonFactory {
                        }
                        
                        // revoke activity points
-                       UserActivityPointHandler::getInstance()->removeEvents('com.woltlab.wcf.like.activityPointEvent.receivedLikes', $likeData);
+                       UserActivityPointHandler::getInstance()->removeEvents('com.woltlab.wcf.like.activityPointEvent.receivedLikes', $activityPoints);
                        
                        // delete likes
                        (new ReactionAction(array_keys($likeData), 'delete'))->executeAction();