|
|
|
@ -238,13 +238,18 @@ defmodule Pleroma.Web.ActivityPub.Utils do
|
|
|
|
|
query =
|
|
|
|
|
from(
|
|
|
|
|
activity in Activity,
|
|
|
|
|
where:
|
|
|
|
|
fragment(
|
|
|
|
|
"? ->> 'type' = 'Follow'",
|
|
|
|
|
activity.data
|
|
|
|
|
),
|
|
|
|
|
where: activity.actor == ^follower_id,
|
|
|
|
|
where:
|
|
|
|
|
fragment(
|
|
|
|
|
"? @> ?",
|
|
|
|
|
activity.data,
|
|
|
|
|
^%{type: "Follow", object: followed_id}
|
|
|
|
|
^%{object: followed_id}
|
|
|
|
|
),
|
|
|
|
|
where: activity.actor == ^follower_id,
|
|
|
|
|
order_by: [desc: :id],
|
|
|
|
|
limit: 1
|
|
|
|
|
)
|
|
|
|
@ -363,13 +368,18 @@ defmodule Pleroma.Web.ActivityPub.Utils do
|
|
|
|
|
query =
|
|
|
|
|
from(
|
|
|
|
|
activity in Activity,
|
|
|
|
|
where:
|
|
|
|
|
fragment(
|
|
|
|
|
"? ->> 'type' = 'Block'",
|
|
|
|
|
activity.data
|
|
|
|
|
),
|
|
|
|
|
where: activity.actor == ^blocker_id,
|
|
|
|
|
where:
|
|
|
|
|
fragment(
|
|
|
|
|
"? @> ?",
|
|
|
|
|
activity.data,
|
|
|
|
|
^%{type: "Block", object: blocked_id}
|
|
|
|
|
^%{object: blocked_id}
|
|
|
|
|
),
|
|
|
|
|
where: activity.actor == ^blocker_id,
|
|
|
|
|
order_by: [desc: :id],
|
|
|
|
|
limit: 1
|
|
|
|
|
)
|
|
|
|
|