From 25f774f7c19a955398976b3f4462cbd51ec700d6 Mon Sep 17 00:00:00 2001 From: Sadposter Date: Tue, 10 Dec 2019 16:41:43 +0000 Subject: [PATCH] format activity_pub.ex --- lib/pleroma/web/activity_pub/activity_pub.ex | 23 ++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/lib/pleroma/web/activity_pub/activity_pub.ex b/lib/pleroma/web/activity_pub/activity_pub.ex index 3c4aed241..29cc1a17b 100644 --- a/lib/pleroma/web/activity_pub/activity_pub.ex +++ b/lib/pleroma/web/activity_pub/activity_pub.ex @@ -915,9 +915,10 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do defp restrict_blocked(query, %{"blocking_user" => %User{} = user}) do blocks = user.blocks || [] domain_blocks = user.domain_blocks || [] + following_ap_ids = - user - |> User.get_friends_ap_ids() + user + |> User.get_friends_ap_ids() query = if has_named_binding?(query, :object), do: query, else: Activity.with_joined_object(query) @@ -933,8 +934,22 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do activity.data, ^blocks ), - where: fragment("(not (split_part(?, '/', 3) = ANY(?))) or ? = ANY(?)", activity.actor, ^domain_blocks, activity.actor, ^following_ap_ids), - where: fragment("(not (split_part(?->>'actor', '/', 3) = ANY(?))) or (?->>'actor') = ANY(?)", o.data, ^domain_blocks, o.data, ^following_ap_ids) + where: + fragment( + "(not (split_part(?, '/', 3) = ANY(?))) or ? = ANY(?)", + activity.actor, + ^domain_blocks, + activity.actor, + ^following_ap_ids + ), + where: + fragment( + "(not (split_part(?->>'actor', '/', 3) = ANY(?))) or (?->>'actor') = ANY(?)", + o.data, + ^domain_blocks, + o.data, + ^following_ap_ids + ) ) end