|> Repo.all()
end
+ def follow_activity(%User{ap_id: ap_id}, %User{ap_id: followed_ap_id}) do
+ Queries.by_type("Follow")
+ |> where([a], a.actor == ^ap_id)
+ |> where([a], fragment("?->>'object' = ?", a.data, ^followed_ap_id))
+ |> where([a], fragment("?->>'state'", a.data) in ["pending", "accept"])
+ |> Repo.one()
+ end
+
def restrict_deactivated_users(query) do
query
- |> join(:inner, [activity], user in User, as: :user, on: activity.actor == user.ap_id and user.is_active == true)
+ |> join(
+ :inner_lateral,
+ [activity],
+ active in fragment(
+ "SELECT is_active from users WHERE ap_id = ? AND is_active = TRUE",
+ activity.actor
+ )
+ )
end
defdelegate search(user, query, options \\ []), to: Pleroma.Search.DatabaseSearch