mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FEATURE: Add new site setting to restrict how many times you can click on an
invite to "passthrough" as logged in, with a default of 0 hours. Also changes default invite expiry from 7 days to 1.
This commit is contained in:
@@ -2,10 +2,19 @@ InviteRedeemer = Struct.new(:invite) do
|
||||
|
||||
def redeem
|
||||
Invite.transaction do
|
||||
process_invitation if invite_was_redeemed?
|
||||
if invite_was_redeemed?
|
||||
process_invitation
|
||||
return invited_user
|
||||
end
|
||||
end
|
||||
|
||||
invited_user
|
||||
# If `invite_passthrough_hours` is defined, allow them to re-use the invite link
|
||||
# to login again.
|
||||
if invite.redeemed_at >= SiteSetting.invite_passthrough_hours.hours.ago
|
||||
return invited_user
|
||||
end
|
||||
|
||||
nil
|
||||
end
|
||||
|
||||
# extracted from User cause it is very specific to invites
|
||||
|
||||
Reference in New Issue
Block a user