Opened 13 years ago
Closed 13 years ago
#3721 closed defect (bug) (fixed)
Mentions do not work if there is a period after the username.
Reported by: | lsparks | Owned by: | |
---|---|---|---|
Milestone: | 1.6 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Activity | Keywords: | has-patch needs-testing |
Cc: |
Description
It appears that mentions do not work if there is a period directly after them.
Example: Hey, everyone say hi to @username.
I took a look at bp_activity_find_mentions() and it appears the expression used to allow usernames like @first.last includes the period all the time, so it incorrectly matches the actual punctuation period as part of the username when the name is at the end of a punctuated sentence. This causes an issue because the username with the period on the end is not technically correct and will not trigger any the notifications or highlighting.
I tried adding a word boundary to the end of the existing expression to get /[@]+([A-Za-z0-9-_.\@]+)\b/ and that seems to work in the limited testing I have done.
Note that this is only an issue if you've activated BP_ENABLE_USERNAME_COMPATIBILITY_MODE.
Patch looks good and tests clean. Thanks!