forked from AkkomaGang/akkoma
Handle Undo activites containing an Announce
This commit is contained in:
parent
4d5ec883b7
commit
e55f69a676
1 changed files with 19 additions and 1 deletions
|
@ -220,9 +220,27 @@ def handle_incoming(
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def handle_incoming(
|
||||||
|
%{
|
||||||
|
"type" => "Undo",
|
||||||
|
"object" => %{"type" => "Announce", "id" => object_id},
|
||||||
|
"actor" => actor,
|
||||||
|
"id" => id
|
||||||
|
} = data
|
||||||
|
) do
|
||||||
|
with %User{} = actor <- User.get_or_fetch_by_ap_id(actor),
|
||||||
|
{:ok, object} <-
|
||||||
|
get_obj_helper(object_id) || ActivityPub.fetch_object_from_id(object_id),
|
||||||
|
{:ok, activity} <- ActivityPub.unannounce(object, false) do
|
||||||
|
{:ok, activity}
|
||||||
|
else
|
||||||
|
e -> :error
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
# TODO
|
# TODO
|
||||||
# Accept
|
# Accept
|
||||||
# Undo
|
# Undo for non-Announce
|
||||||
|
|
||||||
def handle_incoming(_), do: :error
|
def handle_incoming(_), do: :error
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue