forked from AkkomaGang/akkoma
activitypub transmogrifier: accept/reject outgoing: we might send the actual object instead of the URI in some cases, handle it
This commit is contained in:
parent
5eed1ea181
commit
d96377f359
1 changed files with 16 additions and 2 deletions
|
@ -443,7 +443,14 @@ def prepare_outgoing(%{"type" => "Create", "object" => %{"type" => "Note"} = obj
|
||||||
# Mastodon Accept/Reject requires a non-normalized object containing the actor URIs,
|
# Mastodon Accept/Reject requires a non-normalized object containing the actor URIs,
|
||||||
# because of course it does.
|
# because of course it does.
|
||||||
def prepare_outgoing(%{"type" => "Accept"} = data) do
|
def prepare_outgoing(%{"type" => "Accept"} = data) do
|
||||||
with follow_activity <- Activity.get_by_ap_id(data["object"]) do
|
follow_activity_id =
|
||||||
|
if is_binary(data["object"]) do
|
||||||
|
data["object"]
|
||||||
|
else
|
||||||
|
data["object"]["id"]
|
||||||
|
end
|
||||||
|
|
||||||
|
with follow_activity <- Activity.get_by_ap_id(follow_activity_id) do
|
||||||
object = %{
|
object = %{
|
||||||
"actor" => follow_activity.actor,
|
"actor" => follow_activity.actor,
|
||||||
"object" => follow_activity.data["object"],
|
"object" => follow_activity.data["object"],
|
||||||
|
@ -461,7 +468,14 @@ def prepare_outgoing(%{"type" => "Accept"} = data) do
|
||||||
end
|
end
|
||||||
|
|
||||||
def prepare_outgoing(%{"type" => "Reject"} = data) do
|
def prepare_outgoing(%{"type" => "Reject"} = data) do
|
||||||
with follow_activity <- Activity.get_by_ap_id(data["object"]) do
|
follow_activity_id =
|
||||||
|
if is_binary(data["object"]) do
|
||||||
|
data["object"]
|
||||||
|
else
|
||||||
|
data["object"]["id"]
|
||||||
|
end
|
||||||
|
|
||||||
|
with follow_activity <- Activity.get_by_ap_id(follow_activity_id) do
|
||||||
object = %{
|
object = %{
|
||||||
"actor" => follow_activity.actor,
|
"actor" => follow_activity.actor,
|
||||||
"object" => follow_activity.data["object"],
|
"object" => follow_activity.data["object"],
|
||||||
|
|
Loading…
Reference in a new issue