Merge branch 'develop' into fix/reject-third-party-reports

This commit is contained in:
Lain Soykaf 2026-05-13 08:49:20 +04:00
commit 68e4bb53a2
No known key found for this signature in database
3 changed files with 22 additions and 0 deletions

View file

@ -0,0 +1 @@
Handle reports with just actor ap id as the object

View file

@ -450,6 +450,7 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
) do ) do
with context <- data["context"] || Utils.generate_context_id(), with context <- data["context"] || Utils.generate_context_id(),
content <- data["content"] || "", content <- data["content"] || "",
objects <- List.wrap(objects),
%User{} = actor <- User.get_cached_by_ap_id(actor), %User{} = actor <- User.get_cached_by_ap_id(actor),
# Reduce the object list to find the reported user. # Reduce the object list to find the reported user.
%User{} = account <- get_reported(objects), %User{} = account <- get_reported(objects),

View file

@ -103,6 +103,26 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do
refute "Flag" |> Pleroma.Activity.Queries.by_type() |> Pleroma.Repo.one() refute "Flag" |> Pleroma.Activity.Queries.by_type() |> Pleroma.Repo.one()
end end
test "it accepts Flag activities with just actor id as object" do
user = insert(:user)
other_user = insert(:user)
message = %{
"@context" => "https://www.w3.org/ns/activitystreams",
"cc" => [user.ap_id],
"object" => user.ap_id,
"type" => "Flag",
"content" => "blocked AND reported!!!",
"actor" => other_user.ap_id
}
assert {:ok, activity} = Transmogrifier.handle_incoming(message)
assert activity.data["content"] == "blocked AND reported!!!"
assert activity.data["actor"] == other_user.ap_id
assert activity.data["cc"] == [user.ap_id]
end
test "it accepts Move activities" do test "it accepts Move activities" do
old_user = insert(:user) old_user = insert(:user)
new_user = insert(:user) new_user = insert(:user)