mirror of
https://github.com/discourse/discourse.git
synced 2025-06-04 21:59:34 +08:00
fix: support for hyphens in group name
The group mention @ORG-team triggers notifications for the group @ORG. This fix changes the RegExp, so that the group name is correctly extracted. see: https://meta.discourse.org/t/group-mentions-that-begin-with-the-same-characters-may-be-incorrect/39892/12?u=rriemann
This commit is contained in:
@ -206,6 +206,11 @@ describe PostAnalyzer do
|
||||
expect(post_analyzer.raw_mentions).to eq(['jake', 'finn', 'jake_old'])
|
||||
end
|
||||
|
||||
it "handles hyphen in groupname" do
|
||||
post_analyzer = PostAnalyzer.new("@org-board", default_topic_id)
|
||||
expect(post_analyzer.raw_mentions).to eq(['org-board'])
|
||||
end
|
||||
|
||||
it "ignores emails" do
|
||||
post_analyzer = PostAnalyzer.new("1@test.com 1@best.com @best @not", default_topic_id)
|
||||
expect(post_analyzer.raw_mentions).to eq(['best', 'not'])
|
||||
|
@ -426,6 +426,11 @@ describe Post do
|
||||
expect(post.raw_mentions).to eq(['jake', 'finn', 'jake_old'])
|
||||
end
|
||||
|
||||
it "handles hyphen in groupname" do
|
||||
post = Fabricate.build(:post, post_args.merge(raw: "@org-board"))
|
||||
expect(post.raw_mentions).to eq(['org-board'])
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
context "max mentions" do
|
||||
|
Reference in New Issue
Block a user