2
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2025-09-06 10:50:21 +08:00

FIX: ensure the group 'everyone' is never shown when using a different locale

This commit is contained in:
Régis Hanol 2016-10-24 10:53:31 +02:00
parent dc0d302345
commit 81e2a0099f
3 changed files with 8 additions and 12 deletions

View file

@ -149,13 +149,10 @@ class Group < ActiveRecord::Base
group.save!
end
group.name = I18n.t("groups.default_names.#{name}")
# don't allow shoddy localization to break this
validator = UsernameValidator.new(group.name)
unless validator.valid_format?
group.name = name
end
localized_name = I18n.t("groups.default_names.#{name}")
validator = UsernameValidator.new(localized_name)
group.name = validator.valid_format? ? localized_name : name
# the everyone group is special, it can include non-users so there is no
# way to have the membership in a table