summaryrefslogtreecommitdiff
path: root/test/pleroma/web/activity_pub/mrf/force_mentions_in_content_test.exs
diff options
context:
space:
mode:
Diffstat (limited to 'test/pleroma/web/activity_pub/mrf/force_mentions_in_content_test.exs')
-rw-r--r--test/pleroma/web/activity_pub/mrf/force_mentions_in_content_test.exs24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/pleroma/web/activity_pub/mrf/force_mentions_in_content_test.exs b/test/pleroma/web/activity_pub/mrf/force_mentions_in_content_test.exs
index 3bc07be94..589e8fdfb 100644
--- a/test/pleroma/web/activity_pub/mrf/force_mentions_in_content_test.exs
+++ b/test/pleroma/web/activity_pub/mrf/force_mentions_in_content_test.exs
@@ -85,4 +85,28 @@ defmodule Pleroma.Web.ActivityPub.MRF.ForceMentionsInContentTest do
assert filtered ==
"<span class=\"recipients-inline\"><span class=\"h-card\"><a class=\"u-url mention\" data-user=\"#{luigi.id}\" href=\"#{luigi.ap_id}\" rel=\"ugc\">@<span>luigi</span></a></span> <span class=\"h-card\"><a class=\"u-url mention\" data-user=\"#{mario.id}\" href=\"#{mario.ap_id}\" rel=\"ugc\">@<span>mario</span></a></span> </span>WHA-HA!"
end
+
+ test "don't mention self" do
+ mario = insert(:user, nickname: "mario")
+
+ {:ok, post} = CommonAPI.post(mario, %{status: "Mama mia"})
+
+ activity = %{
+ "type" => "Create",
+ "actor" => mario.ap_id,
+ "object" => %{
+ "type" => "Note",
+ "actor" => mario.ap_id,
+ "content" => "I'ma tired...",
+ "to" => [
+ mario.ap_id,
+ Constants.as_public()
+ ],
+ "inReplyTo" => Object.normalize(post).data["id"]
+ }
+ }
+
+ {:ok, %{"object" => %{"content" => filtered}}} = ForceMentionsInContent.filter(activity)
+ assert filtered == "I'ma tired..."
+ end
end