LBPUnion / ProjectLighthouse

Project Lighthouse is a clean-room, open-source custom server for LittleBigPlanet.
GNU Affero General Public License v3.0
211 stars 53 forks source link

Prevent LBP3 reviews from showing up in LBP2 #1015

Closed Slendy closed 6 months ago

Slendy commented 7 months ago

There is currently a bug where if you review an LBP3 level and load your profile in LBP2 the game freaks out because the level data won't be returned because of the GameVersionFilter. This PR adds similar filtering so that reviews from higher game versions are no longer returned. This change adds an extra SQL join to the review query.

new example generated query:

.param set @__targetUserId_0 1
.param set @__token_GameVersion_1 1

SELECT "r"."ReviewId", "r"."Deleted", "r"."DeletedBy", "r"."LabelCollection", "r"."ReviewerId", "r"."SlotId", "r"."Text", "r"."Thumb", "r"."ThumbsDown", "r"."ThumbsUp", "r"."Timestamp"
FROM "Reviews" AS "r"
INNER JOIN "Slots" AS "s" ON "r"."SlotId" = "s"."SlotId"
WHERE "r"."ReviewerId" = @__targetUserId_0 AND "s"."GameVersion" <= @__token_GameVersion_1
ORDER BY "r"."Timestamp" DESC