Verbatim names shouldn't be titleized

סיכום מבוסס בינה מלאכותית

The discussion revolves around a bug in Discourse where names with medial capitals (PascalCase) are titleized, resulting in incorrect formatting. tmcw reports the issue with his name “Tom MacWright” being suggested as “Tom Mac Wright”. After investigating, sam and david discover that the issue applies to all authentication methods due to the User.suggest_name method being used when a name is not provided. david proposes a change to the code, which sam agrees with. sam then implements the fix, which should be live on meta shortly.

Hi!

My name is Tom MacWright. Every time I sign into a Discourse instance, it suggests that I should set my name as “Tom Mac Wright”. Like many folks from Scotland and Ireland, my name has a medial capital, or, in programming terms, is PascalCase.

Anyway, here’s my pitch: Discourse runs this User.suggest_name method that uses titleize to turn MacWright into Mac Wright. Instead, that should only run when you have only a username or an email here. Otherwise, someone put their name on GitHub (Git Hub?), and they likely meant it.

Thanks!

-Tom

8 לייקים

Well, thatmakessense :wink:

5 לייקים

Hmm, so it looks like you are signing in via twitter? Maybe our managed authenticator is not getting name from twitter?

First I would like to confirm which flow needs improving.

2 לייקים

Yes, I signed up here via Twitter. I think I’ve encountered the same bug via GitHub, though.

לייק 1

Yes, it looks like this applies to all authentication methods

I think we can safely change that to

if SiteSetting.enable_names?
  result[:name] = name || User.suggest_name(username || email)
end
9 לייקים

Sure this change looks safe to me. Make it so!

5 לייקים

OK let’s see if this cuts it @tmcw, may take a bit for it to find it’s way everywhere, but should be live on meta shortly.

https://github.com/discourse/discourse/commit/3fbab595d9266dab5b139ef375387bc290cda0df

4 לייקים

https://www.youtube.com/watch?v=fM5F7NC7LSs !

This topic was automatically closed after 7 days. New replies are no longer allowed.