Mentioning problem with short usernames

I have a user who has a username of one character (f). Since Discourse 1.5.betaX mentioning that user with @f does not work anymore. I can remember that it worked in Discourse 1.4.X.

The database queries are too expensive when matching a single character.

Do you support amending this query with the site setting of minimum username length, @sam?

If the auto-suggest starts working on the first sign of the token like the emoji does, I hate to think of the resource cost of all the false starts.

If it could happen after the “end token” (a space?) it might not be so bad.

I don’t know, @zogstrip introduced this change cause autocomplete usernames was brutal.

I feel like single letter usernames are such an edge case that I don’t want to even risk making any changes there. Maybe if we supported Chinese usernames one day I would be more open to hacking on this further.

4 Likes

I have tested against our largest instances and username autocomplete is super fast, especially on 1-letter username. What I am missing here?

Since we can’t use SiteSettings in the mention dialect, I pushed this fix to allow for any username length. It was limited to at least 2 characters before that. (cc @rumpelsepp)

https://github.com/discourse/discourse/commit/f654528aa464af268af6051e7699ba1eeee65cfb

5 Likes