Fix muting reblogs tests
authorrinpatch <rinpatch@sdf.org>
Wed, 27 Mar 2019 10:43:43 +0000 (13:43 +0300)
committerrinpatch <rinpatch@sdf.org>
Wed, 27 Mar 2019 10:43:43 +0000 (13:43 +0300)
test/web/activity_pub/activity_pub_test.exs

index 40bcced33dcfda65b3039cdcb8afb6f3ed18c87a..ac5fbe0a91b88dfac0c8335f507365415efa2611 100644 (file)
@@ -494,7 +494,21 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubTest do
 
       activities = ActivityPub.fetch_activities([], %{"muting_user" => user})
 
-      refute Enum.member?(activities, activity)
+      refute Enum.any?(activities, fn %{id: id} -> id == activity.id end)
+    end
+
+    test "returns reblogs for users for whom reblogs have not been muted" do
+      activity = insert(:note_activity)
+      user = insert(:user)
+      booster = insert(:user)
+      {:ok, user} = CommonAPI.hide_reblogs(user, booster)
+      {:ok, user} = CommonAPI.show_reblogs(user, booster)
+
+      {:ok, activity, _} = CommonAPI.repeat(activity.id, booster)
+
+      activities = ActivityPub.fetch_activities([], %{"muting_user" => user})
+
+      assert Enum.any?(activities, fn %{id: id} -> id == activity.id end)
     end
   end