Add test.
authorlain <lain@soykaf.club>
Sun, 13 May 2018 09:18:48 +0000 (11:18 +0200)
committerlain <lain@soykaf.club>
Sun, 13 May 2018 09:18:48 +0000 (11:18 +0200)
lib/pleroma/web/activity_pub/activity_pub.ex
test/web/activity_pub/activity_pub_test.exs

index ae94b447ae9cef1693e93435c62a798e0a25f6d1..8086c830cb48166e3e6de942d79d83d47bcc250c 100644 (file)
@@ -327,7 +327,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
       activity in query,
       where:
         fragment(
-          "not (?->'cc' \\?| ?)",
+          "(?->'to' \\?| ?)",
           activity.data,
           ^["https://www.w3.org/ns/activitystreams#Public"]
         )
index 6d23adfcd69407525e710943b5e890a800185ee8..d336fad95a2c0aeae6c44af77d8f01f19b3f855e 100644 (file)
@@ -171,6 +171,16 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubTest do
   end
 
   describe "public fetch activities" do
+    test "doesn't retrieve unlisted activities" do
+      user = insert(:user)
+      {:ok, unlisted_activity} = CommonAPI.post(user, %{"status" => "yeah", "visibility" => "unlisted"})
+      {:ok, listed_activity} = CommonAPI.post(user, %{"status" => "yeah"})
+
+      [activity] = ActivityPub.fetch_public_activities()
+
+      assert activity == listed_activity
+    end
+
     test "retrieves public activities" do
       _activities = ActivityPub.fetch_public_activities()