summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorAzul <azul@riseup.net>2017-10-17 11:05:53 +0200
committerAzul <azul@riseup.net>2017-10-17 11:05:53 +0200
commit9414e8ddf4ce7e951a6dc9130d99fa12c5696b94 (patch)
tree53aabf1307e97f89076d222109c6c28b944e5c55 /app
parent3657d09bf7993bb5ac3393e3c5d8c7fb8cae0844 (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.rb8
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