Make deactivated user check into a subquery
authorFloatingGhost <hannah@coffee-and-dreams.uk>
Mon, 6 Dec 2021 11:44:17 +0000 (11:44 +0000)
committerFloatingGhost <hannah@coffee-and-dreams.uk>
Sun, 12 Dec 2021 17:35:02 +0000 (17:35 +0000)
Fixes #2792

test/pleroma/web/activity_pub/activity_pub_test.exs

index a61244c7676657e3be92e4bd0bd91871240afb9a..b57e872470f110d6c8ddaf61dccf80e0cc199fb5 100644 (file)
@@ -776,6 +776,21 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubTest do
     assert Enum.member?(activities, activity_one)
   end
 
+  test "doesn't return activities from deactivated users" do
+    _user = insert(:user)
+    deactivated = insert(:user)
+    active = insert(:user)
+    {:ok, activity_one} = CommonAPI.post(deactivated, %{status: "hey!"})
+    {:ok, activity_two} = CommonAPI.post(active, %{status: "yay!"})
+    {:ok, _updated_user} = User.set_activation(deactivated, false)
+  
+    activities = ActivityPub.fetch_activities([], %{})
+  
+    refute Enum.member?(activities, activity_one)
+    assert Enum.member?(activities, activity_two)
+  end
+
+
   test "always see your own posts even when they address people you block" do
     user = insert(:user)
     blockee = insert(:user)