diff options
author | Azul <azul@riseup.net> | 2017-10-17 11:05:53 +0200 |
---|---|---|
committer | Azul <azul@riseup.net> | 2017-10-17 11:05:53 +0200 |
commit | 9414e8ddf4ce7e951a6dc9130d99fa12c5696b94 (patch) | |
tree | 53aabf1307e97f89076d222109c6c28b944e5c55 /app | |
parent | 3657d09bf7993bb5ac3393e3c5d8c7fb8cae0844 (diff) |
fix: destroy invites used to create test accounts
Production instances are getting cluttered with invites from
test accounts. Instead of marking them as used we will now completely
remove them.
refers to #8804
refers to #8807\
Diffstat (limited to 'app')
-rw-r--r-- | app/models/account.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/app/models/account.rb b/app/models/account.rb index 3283bcc..4442a68 100644 --- a/app/models/account.rb +++ b/app/models/account.rb @@ -43,8 +43,12 @@ class Account end if user.invite_required? user_invite_code = InviteCode.find_by_invite_code user.invite_code - user_invite_code.invite_count += 1 - user_invite_code.save + if user.is_test? && user_invite_code.max_uses == 1 + user_invite_code.destroy + else + user_invite_code.invite_count += 1 + user_invite_code.save + end end end rescue VALIDATION_FAILED => ex |