From 1197ec10a83c2e61251abe383bea2bcc690d9c09 Mon Sep 17 00:00:00 2001 From: Francis Dinh Date: Thu, 24 May 2018 13:26:59 -0400 Subject: [PATCH] Rewrite block fetch query --- lib/pleroma/web/activity_pub/utils.ex | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/pleroma/web/activity_pub/utils.ex b/lib/pleroma/web/activity_pub/utils.ex index 3f88a4672..89d11781d 100644 --- a/lib/pleroma/web/activity_pub/utils.ex +++ b/lib/pleroma/web/activity_pub/utils.ex @@ -366,8 +366,9 @@ def fetch_latest_block(%User{ap_id: blocker_id}, %User{ap_id: blocked_id}) do fragment( "? @> ?", activity.data, - ^%{type: "Block", actor: blocker_id, object: blocked_id} + ^%{type: "Block", object: blocked_id} ), + where: activity.actor == ^blocker_id, order_by: [desc: :id], limit: 1 )