FIX: allow for final sigma in suggested usernames (#11540)
Final sigma is not lower cased correctly in Ruby causing issues with routing. This works around the issue by downcasing all usernames containing a sigma using JS.
This commit is contained in:
parent
758e160862
commit
adf8539f64
|
@ -110,6 +110,14 @@ module UserNameSuggester
|
|||
|
||||
if SiteSetting.unicode_usernames
|
||||
name.unicode_normalize!
|
||||
|
||||
# TODO: Jan 2022, review if still needed
|
||||
# see: https://meta.discourse.org/t/unicode-username-with-as-the-final-char-leads-to-an-error-loading-profile-page/173182
|
||||
if name.include?('Σ')
|
||||
ctx = MiniRacer::Context.new
|
||||
name = ctx.eval("#{name.to_s.to_json}.toLowerCase()")
|
||||
ctx.dispose
|
||||
end
|
||||
else
|
||||
name = ActiveSupport::Inflector.transliterate(name)
|
||||
end
|
||||
|
|
|
@ -128,6 +128,10 @@ describe UserNameSuggester do
|
|||
context "with Unicode usernames enabled" do
|
||||
before { SiteSetting.unicode_usernames = true }
|
||||
|
||||
it "normalizes unicode usernames with Σ to lowercase" do
|
||||
expect(UserNameSuggester.suggest('ΣΣ\'"ΣΣ')).to eq('σς_σς')
|
||||
end
|
||||
|
||||
it "does not transliterate" do
|
||||
expect(UserNameSuggester.suggest("Jørn")).to eq('Jørn')
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue