Fixed Trophy rebuild not skipping already awarded trophies

AlessioDP

Member
Affected version
2.1.1
In XF\Repository\Trophy::updateTrophiesForUser(..) there is a isset to skip already awarded trophies:
Code:
if (isset($userTrophies[$trophy->trophy_id]))
{
   continue;
}

That will return false every time, because the format of the $userTrophies returns an array with key as USER_ID-TROPHY_ID, so to works it should be:
Code:
if (isset($userTrophies[$user->user_id . '-' . $trophy->trophy_id]))
{
   continue;
}
(Or directly returns an array with correct key names)
 
Good catch. This doesn't actually affect anything because ultimately we won't award the trophy twice, but making sure we back out here does save some effort.
 
Thank you for reporting this issue. It has now been resolved and we are aiming to include it in a future XF release (2.1.3).

Change log:
Bail out of updating user trophies earlier if a trophy has already been awarded.
Any changes made as a result of this issue being resolved may not be rolled out here until later.
 
Top Bottom