From: lain Date: Sun, 13 May 2018 09:18:48 +0000 (+0200) Subject: Add test. X-Git-Url: https://git.squeep.com/?a=commitdiff_plain;h=ec531ca281008e7d8d9d659e6f046a551fcb7c8a;p=akkoma Add test. --- diff --git a/lib/pleroma/web/activity_pub/activity_pub.ex b/lib/pleroma/web/activity_pub/activity_pub.ex index ae94b447a..8086c830c 100644 --- a/lib/pleroma/web/activity_pub/activity_pub.ex +++ b/lib/pleroma/web/activity_pub/activity_pub.ex @@ -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"] ) diff --git a/test/web/activity_pub/activity_pub_test.exs b/test/web/activity_pub/activity_pub_test.exs index 6d23adfcd..d336fad95 100644 --- a/test/web/activity_pub/activity_pub_test.exs +++ b/test/web/activity_pub/activity_pub_test.exs @@ -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()