mirror of
https://akkoma.dev/AkkomaGang/akkoma.git
synced 2024-12-30 20:27:22 +00:00
ActivityPub: Change addressing of Undo.
This commit is contained in:
parent
4d38e48558
commit
b7d2ca0372
|
@ -472,14 +472,16 @@ 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,
|
||||||
%Activity{data: %{"context" => context}} = activity,
|
%Activity{data: %{"context" => context, "object" => object}} = activity,
|
||||||
activity_id
|
activity_id
|
||||||
) do
|
) do
|
||||||
|
object = Object.normalize(object)
|
||||||
|
|
||||||
%{
|
%{
|
||||||
"type" => "Undo",
|
"type" => "Undo",
|
||||||
"actor" => ap_id,
|
"actor" => ap_id,
|
||||||
"object" => activity.data,
|
"object" => activity.data,
|
||||||
"to" => [user.follower_address, activity.data["actor"]],
|
"to" => [user.follower_address, object.data["actor"]],
|
||||||
"cc" => [Pleroma.Constants.as_public()],
|
"cc" => [Pleroma.Constants.as_public()],
|
||||||
"context" => context
|
"context" => context
|
||||||
}
|
}
|
||||||
|
@ -488,14 +490,16 @@ defmodule Pleroma.Web.ActivityPub.Utils do
|
||||||
|
|
||||||
def make_unlike_data(
|
def make_unlike_data(
|
||||||
%User{ap_id: ap_id} = user,
|
%User{ap_id: ap_id} = user,
|
||||||
%Activity{data: %{"context" => context}} = activity,
|
%Activity{data: %{"context" => context, "object" => object}} = activity,
|
||||||
activity_id
|
activity_id
|
||||||
) do
|
) do
|
||||||
|
object = Object.normalize(object)
|
||||||
|
|
||||||
%{
|
%{
|
||||||
"type" => "Undo",
|
"type" => "Undo",
|
||||||
"actor" => ap_id,
|
"actor" => ap_id,
|
||||||
"object" => activity.data,
|
"object" => activity.data,
|
||||||
"to" => [user.follower_address, activity.data["actor"]],
|
"to" => [user.follower_address, object.data["actor"]],
|
||||||
"cc" => [Pleroma.Constants.as_public()],
|
"cc" => [Pleroma.Constants.as_public()],
|
||||||
"context" => context
|
"context" => context
|
||||||
}
|
}
|
||||||
|
|
|
@ -760,10 +760,11 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubTest do
|
||||||
{:ok, like_activity, object} = ActivityPub.like(user, object)
|
{:ok, like_activity, object} = ActivityPub.like(user, object)
|
||||||
assert object.data["like_count"] == 1
|
assert object.data["like_count"] == 1
|
||||||
|
|
||||||
{:ok, _, _, object} = ActivityPub.unlike(user, object)
|
{:ok, unlike_activity, _, object} = ActivityPub.unlike(user, object)
|
||||||
assert object.data["like_count"] == 0
|
assert object.data["like_count"] == 0
|
||||||
|
|
||||||
assert Activity.get_by_id(like_activity.id) == nil
|
assert Activity.get_by_id(like_activity.id) == nil
|
||||||
|
assert note_activity.actor in unlike_activity.recipients
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -806,7 +807,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubTest do
|
||||||
|
|
||||||
assert unannounce_activity.data["to"] == [
|
assert unannounce_activity.data["to"] == [
|
||||||
User.ap_followers(user),
|
User.ap_followers(user),
|
||||||
announce_activity.data["actor"]
|
object.data["actor"]
|
||||||
]
|
]
|
||||||
|
|
||||||
assert unannounce_activity.data["type"] == "Undo"
|
assert unannounce_activity.data["type"] == "Undo"
|
||||||
|
|
Loading…
Reference in a new issue