Commit 0251690e authored by normandy's avatar normandy
Browse files

Add federation for unrepeats

parent c9e7b984
......@@ -140,8 +140,10 @@ def announce(
end
end
def unannounce(%User{} = actor, %Object{} = object) do
def unannounce(%User{} = actor, %Object{} = object, local \\ true) do
with %Activity{} = activity <- get_existing_announce(actor.ap_id, object),
unannounce_data <- make_unannounce_data(actor, activity),
{:ok, _unannounce_activity} <- insert(unannounce_data, local),
{:ok, _activity} <- Repo.delete(activity),
{:ok, object} <- remove_announce_from_object(activity, object) do
{:ok, object}
......
......@@ -283,15 +283,15 @@ def make_announce_data(
"""
def make_unannounce_data(
%User{ap_id: ap_id} = user,
%Object{data: %{"id" => id}} = object
%Activity{data: %{"id" => id, "context" => context}} = activity
) do
%{
"type" => "Undo",
"actor" => ap_id,
"object" => id,
"to" => [user.follower_address, object.data["actor"]],
"to" => [user.follower_address, activity.data["actor"]],
"cc" => ["https://www.w3.org/ns/activitystreams#Public"],
"context" => object.data["context"]
"context" => context
}
end
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment