Fixed fastUpdateReactionIsCounted/fastDeleteReactions do not correctly change user's reaction_score


Well-known member
Affected version
Both functions have this loop;
foreach ($updates AS $userId => $contentId)
   $existingReaction = $this->getReactionByContentAndReactionUser($contentType, $contentId, $userId);
   $tally[$userId] = isset($tally[$userId]) ? $tally[$userId] + $existingReaction->reaction_score : 1;

getReactionByContentAndReactionUser returns an \XF\Entity\ReactionContent which does not contain a reaction_score field. The default 1 value, also means these functions do not properly handle reactions with zero or negative reaction scores.

Probably would be best for the function which fetches the updates to fetch the reaction_id and then skip the extra per-user query


Well-known member
On further study of these functions; fetchPair is the wrong query function is being used incorrectly. The user-id will be unique only multiple pieces of content, which is not what is wanted.


XenForo developer
Staff member
It looks like the changes for this bug report have fixed the referenced area here too: