From 429407ba0a2bb2d083d340347faa43767ed8c589 Mon Sep 17 00:00:00 2001 From: FloatingGhost Date: Mon, 6 Dec 2021 11:44:17 +0000 Subject: [PATCH] Make deactivated user check into a subquery Fixes #2792 --- .../web/activity_pub/activity_pub_test.exs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/test/pleroma/web/activity_pub/activity_pub_test.exs b/test/pleroma/web/activity_pub/activity_pub_test.exs index a61244c76..b57e87247 100644 --- a/test/pleroma/web/activity_pub/activity_pub_test.exs +++ b/test/pleroma/web/activity_pub/activity_pub_test.exs @@ -776,6 +776,21 @@ test "doesn't return blocked activities" 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)