mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: Add migration to set correct redemption_count (#12491)
Redeeming email invites did not increase the redemption_count which let those invites in a weird state were they were both pending and redeemed.
This commit is contained in:
@@ -212,7 +212,8 @@ class Invite < ActiveRecord::Base
|
||||
.joins("LEFT JOIN invited_users ON invites.id = invited_users.invite_id")
|
||||
.joins("LEFT JOIN users ON invited_users.user_id = users.id")
|
||||
.where(invited_by_id: inviter.id)
|
||||
.where('redemption_count > max_redemptions_allowed OR expires_at < ?', Time.zone.now)
|
||||
.where('redemption_count < max_redemptions_allowed')
|
||||
.where('expires_at < ?', Time.zone.now)
|
||||
.order('invites.expires_at ASC')
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user