FIX: `Group#name` is case insensitive.

This commit is contained in:
Guo Xiang Tan 2017-03-06 17:24:03 +08:00
parent 66b5f97743
commit 7d82a53dfe
2 changed files with 2 additions and 2 deletions

View File

@ -180,7 +180,7 @@ class Group < ActiveRecord::Base
validator = UsernameValidator.new(localized_name)
group.name =
if !Group.where(name: localized_name).exists? && validator.valid_format?
if !Group.where("lower(name) = ?", localized_name).exists? && validator.valid_format?
localized_name
else
name

View File

@ -182,7 +182,7 @@ describe Group do
I18n.locale = SiteSetting.default_locale = 'de'
another_group = Fabricate(:group,
name: I18n.t('groups.default_names.staff')
name: I18n.t('groups.default_names.staff').upcase
)
group = Group.refresh_automatic_group!(:staff)