summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarius Balteanu <marius.balteanu@zitec.com>2023-11-17 07:30:18 +0000
committerMarius Balteanu <marius.balteanu@zitec.com>2023-11-17 07:30:18 +0000
commit6629fd6f3c15a4eeb9a34c2fd7b1844fe9d08ef5 (patch)
tree4b6f3dd8a2e71c75d1d9a267d3fa970c20cb6d94
parent068559e9dec4dc67c58e5f804417126bf1cc792a (diff)
downloadredmine-6629fd6f3c15a4eeb9a34c2fd7b1844fe9d08ef5.tar.gz
redmine-6629fd6f3c15a4eeb9a34c2fd7b1844fe9d08ef5.zip
Merged r22445, r22449 and r22450 from trunk to 5.0-stable (#39553).
git-svn-id: https://svn.redmine.org/redmine/branches/5.0-stable@22455 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r--lib/redmine/acts/mentionable.rb8
-rw-r--r--test/unit/lib/redmine/acts/mentionable_test.rb7
2 files changed, 8 insertions, 7 deletions
diff --git a/lib/redmine/acts/mentionable.rb b/lib/redmine/acts/mentionable.rb
index c7b0c0655..24adf04b3 100644
--- a/lib/redmine/acts/mentionable.rb
+++ b/lib/redmine/acts/mentionable.rb
@@ -98,12 +98,10 @@ module Redmine
@([A-Za-z0-9_\-@\.]*?)
(?=
(?=[[:punct:]][^A-Za-z0-9_\/])|
- ,|
- \.+$|
\s|
- \]|
- <|
- $)
+ [[:punct:]]?
+ $
+ )
/ix
end
end
diff --git a/test/unit/lib/redmine/acts/mentionable_test.rb b/test/unit/lib/redmine/acts/mentionable_test.rb
index 91fef8eb2..baf505d98 100644
--- a/test/unit/lib/redmine/acts/mentionable_test.rb
+++ b/test/unit/lib/redmine/acts/mentionable_test.rb
@@ -29,9 +29,12 @@ class Redmine::Acts::MentionableTest < ActiveSupport::TestCase
:issues
def test_mentioned_users_with_user_mention
- issue = Issue.generate!(project_id: 1, description: '@dlopper')
+ to_test = %w(@dlopper @dlopper! @dlopper? @dlopper. @dlopper,)
- assert_equal [User.find(3)], issue.mentioned_users
+ to_test.each do |item|
+ issue = Issue.generate!(project_id: 1, description: item)
+ assert_equal [User.find(3)], issue.mentioned_users
+ end
end
def test_mentioned_users_with_user_mention_having_mail_as_login