Recent migration to discourse caused usernames to change!

No. Discourse does not allow spaces or (most) special characters in usernames. That’s why they got re-written.

I don’t understand what you’re saying about URL.

It has to use something to generate a username.

It does this:

UserNameSuggester.suggest(
        opts[:username].presence || opts[:name].presence || opts[:email],

So if you don’t have a username or a name it falls back to using the first part of the email address.