Handle reports with just actor ap id as the object
Signed-off-by: nicole mikołajczyk <git@mkljczk.pl>
This commit is contained in:
parent
960c730706
commit
4d3aea1fce
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
|
) 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),
|
||||||
|
|
|
||||||
|
|
@ -86,6 +86,26 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do
|
||||||
assert activity.data["cc"] == [user.ap_id]
|
assert activity.data["cc"] == [user.ap_id]
|
||||||
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)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue