Mention a username with spaces



  • Hey there,
    would it be possible to make mentioning users with spaces in their username work?
    We have many users with names like John Frikkin Doe which can currently only be mentioned by using @John-Frikkin-Doe, which is bad since I successfully got them to use @"John Frikkin Doe" 😄

    Some choice in the ACP for different regexes would be nice here...



  • @John-Frikkin-Doe is already in use for John.Frikkin.Doe.



  • Ya well you can mention users via their profile slug or their username, while the latter only works with usernames without spaces so far...



  • I have created John.Frikkin.Doe mentioned him and changed username to John Frikkin Doe. It works for both of them.

    Type @ and start writing Joh use arrows and hit Enter.



  • But you cannot mention @John Frikkin Doe, can you?



  • Sure you can. Use dropdown menu after @ and type first part of username.



  • Issued a bug report with a mention preview in Registration form.
    https://github.com/NodeBB/NodeBB/issues/2992

    nhlpl created this issue in NodeBB/NodeBB

    closed Mention a username with spaces #2992


  • Admin

    @Moritz-Friedrich, in both cases, the username is normalised down to a format that is easily parsable, and url valid.

    So both "John Frikkin Doe" and "John.Frikkin.Doe" have their slug as "john-frikkin-doe".

    Because of this slug collision, we heavily enforce that no two users can have the same slug, as a username:userslug mapping should go both ways.

    I will admit that it is not readily intuitive to use dashes to reference a username with spaces, but this is a compromise, because otherwise it would be computationally exhaustive to search for mentions in post content.

    For example:

    This is post content with a mention for @john-frikkin-doe how are you today?

    It is quite easy to match the mention here. I search for @ followed by letters and dashes. In reality it is a bit more complicated due to internationalization issues, but I digress...

    This is post content with a mention for @John Frikkin Doe how are you today?

    This is bad because a possible match would be practically anything after the @.

    So I'd have to make multiple hits against the database to check if the following users exist:

    • John
    • John Frikkin
    • John Frikkin Doe
    • John Frikkin Doe how
    • John Frikkin Doe how are
    • John Frikkin Doe how are you
    • John Frikkin Doe how are you today

    See the problem? 😄



  • @julian said:

    So I'd have to make multiple hits against the database to check if the following users exist:

    • John
    • John Frikkin
    • John Frikkin Doe
    • John Frikkin Doe how
    • John Frikkin Doe how are
    • John Frikkin Doe how are you
    • John Frikkin Doe how are you today

    See the problem? 😄

    I thought about this while posting the thread. I think I'll just disallow spaces in usernames 😄

    But hey, thank you for the extensive reply!


 

Suggested Topics

  • 3
  • 9
  • 2
  • 3
  • 8
| |