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

View File

@ -171,6 +171,16 @@ test "doesn't return blocked activities" 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()