mirror of
https://git.pleroma.social/sjw/pleroma.git
synced 2024-12-27 21:25:20 +01:00
Handle nil cases.
This commit is contained in:
parent
8ef58a266b
commit
867ac1e4f5
@ -164,8 +164,8 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub 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 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubTest 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
|
||||
|
Loading…
Reference in New Issue
Block a user