Merge branch 'develop' of git.pleroma.social:pleroma/pleroma into develop
authorRoger Braun <roger@rogerbraun.net>
Sun, 5 Nov 2017 11:12:19 +0000 (12:12 +0100)
committerRoger Braun <roger@rogerbraun.net>
Sun, 5 Nov 2017 11:12:19 +0000 (12:12 +0100)
1  2 
lib/pleroma/web/activity_pub/activity_pub.ex
test/web/activity_pub/activity_pub_test.exs

index 48597f5fbcd55e834beb45916f1e0fb153c0f410,a02740d5d8780b2882b646c3b4ac1e4e5ced41a0..2cd33d623ee42a7c29b2df54494ce7e91ea91900
@@@ -80,10 -83,32 +83,34 @@@ defmodule Pleroma.Web.ActivityPub.Activ
      end
    end
  
+   test "doesn't return blocked activities" do
+     activity_one = insert(:note_activity)
+     activity_two = insert(:note_activity)
+     user = insert(:user)
+     {:ok, user} = User.block(user, %{ap_id: activity_one.data["actor"]})
+     activities = ActivityPub.fetch_activities([], %{"blocking_user" => user})
+     assert Enum.member?(activities, activity_two)
+     refute Enum.member?(activities, activity_one)
+     {:ok, user} = User.unblock(user, %{ap_id: activity_one.data["actor"]})
+     activities = ActivityPub.fetch_activities([], %{"blocking_user" => user})
+     assert Enum.member?(activities, activity_two)
+     assert Enum.member?(activities, activity_one)
+     activities = ActivityPub.fetch_activities([], %{"blocking_user" => nil})
+     assert Enum.member?(activities, activity_two)
+     assert Enum.member?(activities, activity_one)
+   end
    describe "public fetch activities" do
      test "retrieves public activities" do
 +      activities = ActivityPub.fetch_public_activities
 +
        %{public: public} = ActivityBuilder.public_and_non_public
  
        activities = ActivityPub.fetch_public_activities