From 53b761dfe9c2965123da52bc04f968c0dd6a0d1b Mon Sep 17 00:00:00 2001 From: evazion Date: Fri, 3 Apr 2020 23:30:48 -0500 Subject: [PATCH] user deletions: fix rename conflict logic. Remove the 10-try limit when there's a name conflict during renaming. We forgot to increment the loop counter so this did nothing. This wasn't necessary anyway since the loop will always terminate eventually because names have finite length. --- app/logical/user_deletion.rb | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/app/logical/user_deletion.rb b/app/logical/user_deletion.rb index f3b283855..67bd6ee50 100644 --- a/app/logical/user_deletion.rb +++ b/app/logical/user_deletion.rb @@ -50,12 +50,7 @@ class UserDeletion def rename name = "user_#{user.id}" - n = 0 - name += "~" while User.where(:name => name).exists? && (n < 10) - - if n == 10 - raise ValidationError.new("New name could not be found") - end + name += "~" while User.exists?(name: name) request = UserNameChangeRequest.new(user: user, desired_name: name, original_name: user.name) request.save!(validate: false) # XXX don't validate so that the 1 name change per week rule doesn't interfere