From 1b300f138f4626b3cebd8ff1ff1d2af47ad856cc Mon Sep 17 00:00:00 2001 From: Marius Balteanu Date: Mon, 20 Jun 2022 05:50:29 +0000 Subject: 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 --- lib/redmine/acts/mentionable.rb | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'lib/redmine') 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 -- cgit v1.2.3