Commit 867ac1e4 authored by lain's avatar lain
Browse files

Handle nil cases.

parent 8ef58a26
......@@ -164,8 +164,8 @@ defp restrict_recent(query, _) do
where: activity.id > ^since
end
defp restrict_blocked(query, %{"blocking_user" => user}) do
blocks = user.info["blocks"] || []
defp restrict_blocked(query, %{"blocking_user" => %User{info: info}}) do
blocks = info["blocks"] || []
from activity in query,
where: fragment("not (?->>'actor' = ANY(?))", activity.data, ^blocks)
end
......
......@@ -100,6 +100,11 @@ test "doesn't return blocked activities" do
assert Enum.member?(activities, activity_two)
assert Enum.member?(activities, activity_one)
activities = ActivityPub.fetch_activities([], %{"blocking_user" => nil})
assert Enum.member?(activities, activity_two)
assert Enum.member?(activities, activity_one)
end
describe "public fetch activities" do
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment