Verbatim names shouldn't be titleized

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 Likes

Well, thatmakessense :wink:

5 Likes

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 Likes

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

1 Like

Yes, it looks like this applies to all authentication methods

https://github.com/discourse/discourse/blob/master/lib/auth/result.rb#L73-L75

I think we can safely change that to

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

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

5 Likes

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 Likes

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

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