Add support for cancellation of a follow request

This commit is contained in:
Egor Kislitsyn 2020-02-04 20:35:32 +04:00
commit 8c71f7e11a
5 changed files with 75 additions and 10 deletions

View file

@ -490,6 +490,15 @@ defmodule Pleroma.Web.ActivityPub.Utils do
|> Repo.one()
end
def fetch_latest_undo(%User{ap_id: ap_id}) do
"Undo"
|> Activity.Queries.by_type()
|> where(actor: ^ap_id)
|> order_by([activity], fragment("? desc nulls last", activity.id))
|> limit(1)
|> Repo.one()
end
def get_latest_reaction(internal_activity_id, %{ap_id: ap_id}, emoji) do
%{data: %{"object" => object_ap_id}} = Activity.get_by_id(internal_activity_id)