We must change to/cc in the activity and inner object

This commit is contained in:
Mark Felder 2024-08-08 15:23:59 -04:00
parent d6cc6aff9b
commit 5a134a46f7
2 changed files with 15 additions and 2 deletions

View file

@ -16,11 +16,11 @@ defmodule Pleroma.Web.ActivityPub.MRF.QuietReply do
def filter( def filter(
%{ %{
"type" => "Create", "type" => "Create",
"to" => to,
"cc" => cc,
"object" => %{ "object" => %{
"actor" => actor, "actor" => actor,
"type" => "Note", "type" => "Note",
"to" => to,
"cc" => cc,
"inReplyTo" => in_reply_to "inReplyTo" => in_reply_to
} }
} = object } = object
@ -38,6 +38,8 @@ defmodule Pleroma.Web.ActivityPub.MRF.QuietReply do
updated_object = updated_object =
object object
|> Map.put("to", updated_to)
|> Map.put("cc", updated_cc)
|> put_in(["object", "to"], updated_to) |> put_in(["object", "to"], updated_to)
|> put_in(["object", "cc"], updated_cc) |> put_in(["object", "cc"], updated_cc)

View file

@ -21,6 +21,11 @@ defmodule Pleroma.Web.ActivityPub.MRF.QuietReplyTest do
reply = %{ reply = %{
"type" => "Create", "type" => "Create",
"actor" => robin.ap_id, "actor" => robin.ap_id,
"to" => [
batman.ap_id,
Pleroma.Constants.as_public()
],
"cc" => [robin.follower_address],
"object" => %{ "object" => %{
"type" => "Note", "type" => "Note",
"actor" => robin.ap_id, "actor" => robin.ap_id,
@ -39,6 +44,8 @@ defmodule Pleroma.Web.ActivityPub.MRF.QuietReplyTest do
assert {:ok, filtered} = QuietReply.filter(reply) assert {:ok, filtered} = QuietReply.filter(reply)
assert expected_to == filtered["to"]
assert expected_cc == filtered["cc"]
assert expected_to == filtered["object"]["to"] assert expected_to == filtered["object"]["to"]
assert expected_cc == filtered["object"]["cc"] assert expected_cc == filtered["object"]["cc"]
end end
@ -52,6 +59,8 @@ defmodule Pleroma.Web.ActivityPub.MRF.QuietReplyTest do
reply = %{ reply = %{
"type" => "Create", "type" => "Create",
"actor" => robin.ap_id, "actor" => robin.ap_id,
"to" => [batman.ap_id],
"cc" => [],
"object" => %{ "object" => %{
"type" => "Note", "type" => "Note",
"actor" => robin.ap_id, "actor" => robin.ap_id,
@ -76,6 +85,8 @@ defmodule Pleroma.Web.ActivityPub.MRF.QuietReplyTest do
reply = %{ reply = %{
"type" => "Create", "type" => "Create",
"actor" => robin.ap_id, "actor" => robin.ap_id,
"to" => [batman.ap_id, robin.follower_address],
"cc" => [],
"object" => %{ "object" => %{
"type" => "Note", "type" => "Note",
"actor" => robin.ap_id, "actor" => robin.ap_id,