diff options
author | azul <azul@riseup.net> | 2017-10-17 09:11:33 +0000 |
---|---|---|
committer | azul <azul@riseup.net> | 2017-10-17 09:11:33 +0000 |
commit | 3cf07b870cf5fa20714dadec38680876b0657108 (patch) | |
tree | 53aabf1307e97f89076d222109c6c28b944e5c55 /app/models | |
parent | 3657d09bf7993bb5ac3393e3c5d8c7fb8cae0844 (diff) | |
parent | 9414e8ddf4ce7e951a6dc9130d99fa12c5696b94 (diff) |
Merge branch 'bugfix/8804-destroy-invites' into 'master'
fix: destroy invites used to create test accounts
See merge request leap/webapp!47
Diffstat (limited to 'app/models')
-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 |