Remote Timeline: add Streaming support
[akkoma] / test / web / activity_pub / mrf / simple_policy_test.exs
index c0e82731be3c713fbde634baae9168bab90e2736..d7dde62c40c8643bf2fbafc3b4fc7c08f6b17ec9 100644 (file)
@@ -290,6 +290,15 @@ defmodule Pleroma.Web.ActivityPub.MRF.SimplePolicyTest do
         "cc" => [actor.follower_address, "http://foo.bar/qux"]
       }
 
+      dm_activity = %{
+        "actor" => actor.ap_id,
+        "to" => [
+          following_user.ap_id,
+          non_following_user.ap_id
+        ],
+        "cc" => []
+      }
+
       actor_domain =
         activity
         |> Map.fetch!("actor")
@@ -299,12 +308,16 @@ defmodule Pleroma.Web.ActivityPub.MRF.SimplePolicyTest do
       Config.put([:mrf_simple, :followers_only], [actor_domain])
 
       assert {:ok, new_activity} = SimplePolicy.filter(activity)
-      assert actor.follower_address in new_activity["to"]
+      assert actor.follower_address in new_activity["cc"]
       assert following_user.ap_id in new_activity["to"]
       refute "https://www.w3.org/ns/activitystreams#Public" in new_activity["to"]
       refute "https://www.w3.org/ns/activitystreams#Public" in new_activity["cc"]
       refute non_following_user.ap_id in new_activity["to"]
       refute non_following_user.ap_id in new_activity["cc"]
+
+      assert {:ok, new_dm_activity} = SimplePolicy.filter(dm_activity)
+      assert new_dm_activity["to"] == [following_user.ap_id]
+      assert new_dm_activity["cc"] == []
     end
   end