- Affected version
- 2.1.2
Both functions have this loop;
Probably would be best for the function which fetches the updates to fetch the
PHP:
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