Actions
Defect #37138
closedMentions of users with "@" in their username
Status:
Closed
Priority:
Normal
Assignee:
Category:
Email notifications
Target version:
Start date:
Due date:
% Done:
0%
Estimated time:
Resolution:
Fixed
Affected version:
Description
When mentioning a user that has an "@" in their username no email is sent to the user.
Updated by David Robinson over 2 years ago
Usernames here are often of the form: user@domain.tld
Updated by VD DV over 2 years ago
We have same behavior at our 5.0 installation.
Updated by David Robinson over 2 years ago
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.
Updated by Marius BĂLTEANU over 2 years ago
- Assignee set to Marius BĂLTEANU
- Target version set to 5.0.2
Updated by Marius BĂLTEANU over 2 years ago
- 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.
Updated by Marius BĂLTEANU over 2 years ago
- Status changed from Resolved to Closed
Actions