Add test for blocked domains
authorAaron Tinio <aptinio@gmail.com>
Tue, 14 May 2019 22:13:47 +0000 (06:13 +0800)
committerAaron Tinio <aptinio@gmail.com>
Wed, 15 May 2019 21:53:51 +0000 (05:53 +0800)
test/web/activity_pub/activity_pub_test.exs

index 0f90aa1acb072585fed756c1f745536669d8de29..442120ffda0aa97da20b0d98152e054d02a7fb85 100644 (file)
@@ -462,6 +462,20 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubTest do
     refute Enum.member?(activities, activity_three.id)
   end
 
+  test "doesn't return activities from blocked domains" do
+    domain = "dogwhistle.zone"
+    domain_user = insert(:user, %{ap_id: "https://#{domain}/@pundit"})
+    note = insert(:note, %{data: %{"actor" => domain_user.ap_id}})
+    activity = insert(:note_activity, %{note: note})
+    user = insert(:user)
+    {:ok, user} = User.block_domain(user, domain)
+
+    activities =
+      ActivityPub.fetch_activities([], %{"blocking_user" => user, "skip_preload" => true})
+
+    refute activity in activities
+  end
+
   test "doesn't return muted activities" do
     activity_one = insert(:note_activity)
     activity_two = insert(:note_activity)