I’m wondering how mentions works if the username being @mentioned has spaces in it.

I don’t like that drupal allows spaces by default but so it is and some of my users have spaces in their username.

Thoughts?

CommentFileSizeAuthor
#3 usernames-with-spaces.patch821 bytesmarkwittens

Issue fork mentions-3087707

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

destinationsound created an issue. See original summary.

destinationsound’s picture

Issue summary: View changes
markwittens’s picture

StatusFileSize
new821 bytes

Usernames with spaces are not yet detected properly, the attached patch fixes this issue.

markwittens’s picture

Category: Support request » Bug report
Status: Active » Needs review
sreenivasparuchuri’s picture

I have usernames which contain hyphens(-) and dots(-), how to handle this, is there any way to make that pattern configurable

nuez’s picture

The patch in #3 doesn't really work. In fact user names with spaces I think will be a difficult story.

Imagine finding a user name in the following phrase:

"The @quick brown fox jumps over the lazy dog"

If the user name is quick, it would be easy. However the algorithm would have to match all possible matches after the @ sign, e.g.

- quick
- quick brown
- quick brown fox
- quick brown fox jumps.

There might be a user called 'quick brown fox'. The only thing you know is the maximum length of the user name, and you can limit the search to that amount of characters.

ivnish’s picture

Status: Needs review » Needs work

andileco made their first commit to this issue’s fork.

robpowell made their first commit to this issue’s fork.

robpowell’s picture

How about we go with matching anything between the prefix and suffix? This change in essence makes the pattern (?:\[~)([^\]]+)\].

This will match periods, hyphens and spaces.

robpowell’s picture

Status: Needs work » Needs review