Merge pull request 'Handle reports with just actor ap id as the object' (#7897) from mkljczk/pleroma:iceshrimpnet-reports-fix into develop
Reviewed-on: https://git.pleroma.social/pleroma/pleroma/pulls/7897
This commit is contained in:
commit
d8e9affded
3 changed files with 22 additions and 0 deletions
1
changelog.d/iceshrimpnet-reports-fix.fix
Normal file
1
changelog.d/iceshrimpnet-reports-fix.fix
Normal file
|
|
@ -0,0 +1 @@
|
|||
Handle reports with just actor ap id as the object
|
||||
|
|
@ -444,6 +444,7 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
|
|||
) do
|
||||
with context <- data["context"] || Utils.generate_context_id(),
|
||||
content <- data["content"] || "",
|
||||
objects <- List.wrap(objects),
|
||||
%User{} = actor <- User.get_cached_by_ap_id(actor),
|
||||
# Reduce the object list to find the reported user.
|
||||
%User{} = account <- get_reported(objects),
|
||||
|
|
|
|||
|
|
@ -86,6 +86,26 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do
|
|||
assert activity.data["cc"] == [user.ap_id]
|
||||
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
|
||||
old_user = insert(:user)
|
||||
new_user = insert(:user)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue