Add test.

This commit is contained in:
lain 2018-05-13 11:18:48 +02:00
parent 29376fcc13
commit ec531ca281
2 changed files with 11 additions and 1 deletions

View 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"]
)

View 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()