Fix #4680: @-ing yourself sends you a DMail.

Don't send a dmail when the user @-mentions themselves, whether in an
edit or in the original message.
This commit is contained in:
evazion
2021-02-03 23:46:59 -06:00
parent 50864c7147
commit 3f16fe3d80
2 changed files with 12 additions and 4 deletions

View File

@@ -60,6 +60,12 @@ class ForumPostTest < ActiveSupport::TestCase
EOS
end
end
should "not send a mention to yourself" do
assert_no_difference("Dmail.count") do
@forum_post = as(@user) { create(:forum_post, body: "hi from @#{@user.name}") }
end
end
end
context "that belongs to a topic with several pages of posts" do