Add federation for unrepeats
This commit is contained in:
parent
c9e7b984d5
commit
0251690e96
2 changed files with 6 additions and 4 deletions
|
@ -140,8 +140,10 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
|
||||||
end
|
end
|
||||||
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),
|
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, _activity} <- Repo.delete(activity),
|
||||||
{:ok, object} <- remove_announce_from_object(activity, object) do
|
{:ok, object} <- remove_announce_from_object(activity, object) do
|
||||||
{:ok, object}
|
{:ok, object}
|
||||||
|
|
|
@ -283,15 +283,15 @@ defmodule Pleroma.Web.ActivityPub.Utils do
|
||||||
"""
|
"""
|
||||||
def make_unannounce_data(
|
def make_unannounce_data(
|
||||||
%User{ap_id: ap_id} = user,
|
%User{ap_id: ap_id} = user,
|
||||||
%Object{data: %{"id" => id}} = object
|
%Activity{data: %{"id" => id, "context" => context}} = activity
|
||||||
) do
|
) do
|
||||||
%{
|
%{
|
||||||
"type" => "Undo",
|
"type" => "Undo",
|
||||||
"actor" => ap_id,
|
"actor" => ap_id,
|
||||||
"object" => 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"],
|
"cc" => ["https://www.w3.org/ns/activitystreams#Public"],
|
||||||
"context" => object.data["context"]
|
"context" => context
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue