FIX: refreshing auto groups when min_username_length is long

This commit is contained in:
Sam
2018-08-15 16:59:56 +10:00
parent 38c10a3dc2
commit 243fc9d0f9
2 changed files with 21 additions and 2 deletions

View File

@@ -599,7 +599,15 @@ class Group < ActiveRecord::Base
protected
def name_format_validator
self.name.strip!
return if !name_changed?
# avoid strip! here, it works now
# but may not continue to work long term, especially
# once we start returning frozen strings
if self.name != (stripped = self.name.strip)
self.name = stripped
end
UsernameValidator.perform_validation(self, 'name') || begin
name_lower = self.name.downcase