Gamification and invitations

RGJ
Sun, 25 Jun 2023 10:47:31 +0000
Bug

When using the Gamification plugin, points are rewarded for redeemed invitations.
This is easily abused by sending out invites and redeeming them with a duplicate (fake) account.
When such a fake account is removed by the admin, the behavior of the gamification plugin (and the invite system) depends on how the invite was sent.

If the invite was tied to a specific email address and the user is removed, then both the invite record and user_invite records are hard(!) deleted. The next time the Sidekiq UpdateScoresFor* job runs, the gamification plugin will deduct the awarded points from the score again.

If the invite was not tied to a specific email address and the user is removed, then the invited_users record will be removed, but the invite record will stay. The redemption_count value will not be decreased. This makes sense from one point of view because the invite redemption has taken place, even though the user has been removed afterwards. But the Gamification plugin uses the redemption_count to calculate the score so the points will not be deducted.

While debugging this, I also found that the score job will only consider invites that are less than 10 days old. So if an invite is redeemed after 11 days, no points will be awarded at all. I was going to say 'I guess it needs to look at updated_at instead of created_at but when the redemption count for the invite is increased, the updated_at timestamp is not being touched.

8 messaggi - 3 partecipanti