Defect #37138
closed
Mentions of users with "@" in their username
Added by David Robinson over 2 years ago.
Updated over 2 years ago.
Category:
Email notifications
Description
When mentioning a user that has an "@" in their username no email is sent to the user.
We have same behavior at our 5.0 installation.
VD DV wrote:
We have same behavior at our 5.0 installation.
In case you want a workaround while this is fixed, I have made the following in a "plugin" to fix it here:
Redmine::Acts::Mentionable::InstanceMethods.module_eval do
def scan_for_mentioned_users(content)
return [] if content.nil?
# remove quoted text
content = content.gsub(%r{\r\n(?:\>\s)+(.*?)\r\n}m, '')
text_formatting = Setting.text_formatting
# Remove text wrapped in pre tags based on text formatting
case text_formatting
when 'textile'
content = content.gsub(%r{<pre>(.*?)</pre>}m, '')
when 'markdown', 'common_mark'
content = content.gsub(%r{(~~~|```)(.*?)(~~~|```)}m, '')
end
users = 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
(?=
\.+[ \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
)
/ix
end
This works here, but I have no idea if there are some quirky edge-cases where it might break.
You can either make a plugin with it, or just patch the lib/redmine/acts/mentionable file.
- Assignee set to Marius BĂLTEANU
- Target version set to 5.0.2
- Category set to Email notifications
- Status changed from New to Resolved
- Resolution set to Fixed
Fix committed. I've reused the Regex from user links.
- Status changed from Resolved to Closed
Also available in: Atom
PDF