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 @@ defp restrict_unlisted(query) do
activity in query, activity in query,
where: where:
fragment( fragment(
"not (?->'cc' \\?| ?)", "(?->'to' \\?| ?)",
activity.data, activity.data,
^["https://www.w3.org/ns/activitystreams#Public"] ^["https://www.w3.org/ns/activitystreams#Public"]
) )

View File

@ -171,6 +171,16 @@ test "doesn't return blocked activities" do
end end
describe "public fetch activities" do 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 test "retrieves public activities" do
_activities = ActivityPub.fetch_public_activities() _activities = ActivityPub.fetch_public_activities()