summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorMarius Balteanu <marius.balteanu@zitec.com>2022-06-20 05:50:29 +0000
committerMarius Balteanu <marius.balteanu@zitec.com>2022-06-20 05:50:29 +0000
commit1b300f138f4626b3cebd8ff1ff1d2af47ad856cc (patch)
tree3c4cf0c096e8ad44f1386b44795836d7099634d0 /lib
parent6f5920e4cb1e4c69942a7a370d3da06479137ab7 (diff)
downloadredmine-1b300f138f4626b3cebd8ff1ff1d2af47ad856cc.tar.gz
redmine-1b300f138f4626b3cebd8ff1ff1d2af47ad856cc.zip
Fix mentions of users with "@" in their username not working (#37138).
git-svn-id: https://svn.redmine.org/redmine/trunk@21660 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib')
-rw-r--r--lib/redmine/acts/mentionable.rb19
1 files changed, 10 insertions, 9 deletions
diff --git a/lib/redmine/acts/mentionable.rb b/lib/redmine/acts/mentionable.rb
index 264d1f50b..1629bbe41 100644
--- a/lib/redmine/acts/mentionable.rb
+++ b/lib/redmine/acts/mentionable.rb
@@ -90,19 +90,20 @@ module Redmine
content = content.gsub(%r{(~~~|```)(.*?)(~~~|```)}m, '')
end
- users = content.scan(MENTION_PATTERN).flatten
+ content.scan(MENTION_PATTERN).flatten
end
MENTION_PATTERN = /
- (?:^|\W) # beginning of string or non-word char
- @((?>[a-z0-9][a-z0-9-]*)) # @username
- (?!\/) # without a trailing slash
+ (?:^|\W)
+ @([A-Za-z0-9_\-@\.]*?)
(?=
- \.+[ \t\W]| # dots followed by space or non-word character
- \.+$| # dots at end of line
- [^0-9a-zA-Z_.]| # non-word character except dot
- $ # end of line
- )
+ (?=[[:punct:]][^A-Za-z0-9_\/])|
+ ,|
+ \.+$|
+ \s|
+ \]|
+ <|
+ $)
/ix
end
end