Defect #37138
Mentions of users with "@" in their username
Status: | Closed | Start date: | ||
---|---|---|---|---|
Priority: | Normal | Due date: | ||
Assignee: | % Done: | 0% | ||
Category: | Email notifications | |||
Target version: | 5.0.2 | |||
Resolution: | Fixed | Affected version: | 5.0.0 |
Description
When mentioning a user that has an "@" in their username no email is sent to the user.
Associated revisions
Fix mentions of users with "@" in their username not working (#37138).
Fix random failing test (#37138).
History
#1
Updated by David Robinson about 1 month ago
Usernames here are often of the form: user@domain.tld
#2
Updated by VD DV about 1 month ago
We have same behavior at our 5.0 installation.
#3
Updated by David Robinson about 1 month 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.
#4
Updated by Marius BALTEANU 29 days ago
- Assignee set to Marius BALTEANU
- Target version set to 5.0.2
#5
Updated by Marius BALTEANU 6 days 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.
#6
Updated by Marius BALTEANU 5 days ago
- Status changed from Resolved to Closed