- def blocks?(%User{info: info} = _user, %{ap_id: ap_id}) do
- blocks = info.blocks
- domain_blocks = info.domain_blocks
- %{host: host} = URI.parse(ap_id)
+ def blocks?(%User{} = user, %User{} = target) do
+ blocks_ap_id?(user, target) || blocks_domain?(user, target)
+ end
+
+ def blocks?(nil, _), do: false
+
+ def blocks_ap_id?(%User{} = user, %User{} = target) do
+ Enum.member?(user.info.blocks, target.ap_id)
+ end
+
+ def blocks_ap_id?(_, _), do: false