logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma git clone https://hacktivis.me/git/pleroma.git
commit: 99eab1fa2a39b7a7fba6cdbb92c01e9c7c81aa88
parent 7de657ac45e13f9809ad1fbd4b2429d2045e8f89
Author: feld <feld@feld.me>
Date:   Thu, 16 May 2024 23:34:00 +0000

Merge branch 'revert-e944b152' into 'develop'

Revert "Merge branch 'strip-object-actor' into 'develop'"

See merge request pleroma/pleroma!4112

Diffstat:

Dchangelog.d/strip-object-actor.fix1-
Mlib/pleroma/constants.ex1-
Mtest/fixtures/create-chat-message.json8++++----
Mtest/pleroma/user/backup_test.exs2++
Mtest/pleroma/web/activity_pub/transmogrifier/chat_message_test.exs2++
Mtest/pleroma/web/activity_pub/transmogrifier_test.exs5++---
6 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/changelog.d/strip-object-actor.fix b/changelog.d/strip-object-actor.fix @@ -1 +0,0 @@ -Strip actor property from objects before federating diff --git a/lib/pleroma/constants.ex b/lib/pleroma/constants.ex @@ -9,7 +9,6 @@ defmodule Pleroma.Constants do const(object_internal_fields, do: [ - "actor", "reactions", "reaction_count", "likes", diff --git a/test/fixtures/create-chat-message.json b/test/fixtures/create-chat-message.json @@ -1,10 +1,10 @@ { - "actor": "http://mastodon.example.org/users/admin", - "id": "http://mastodon.example.org/objects/1", + "actor": "http://2hu.gensokyo/users/raymoo", + "id": "http://2hu.gensokyo/objects/1", "object": { - "attributedTo": "http://mastodon.example.org/users/admin", + "attributedTo": "http://2hu.gensokyo/users/raymoo", "content": "You expected a cute girl? Too bad. <script>alert('XSS')</script>", - "id": "http://mastodon.example.org/objects/2", + "id": "http://2hu.gensokyo/objects/2", "published": "2020-02-12T14:08:20Z", "to": [ "http://2hu.gensokyo/users/marisa" diff --git a/test/pleroma/user/backup_test.exs b/test/pleroma/user/backup_test.exs @@ -221,6 +221,7 @@ defmodule Pleroma.User.BackupTest do "orderedItems" => [ %{ "object" => %{ + "actor" => "http://cofe.io/users/cofe", "content" => "status1", "type" => "Note" }, @@ -228,6 +229,7 @@ defmodule Pleroma.User.BackupTest do }, %{ "object" => %{ + "actor" => "http://cofe.io/users/cofe", "content" => "status2" } }, diff --git a/test/pleroma/web/activity_pub/transmogrifier/chat_message_test.exs b/test/pleroma/web/activity_pub/transmogrifier/chat_message_test.exs @@ -116,6 +116,8 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier.ChatMessageTest do data = File.read!("test/fixtures/create-chat-message.json") |> Jason.decode!() + |> Map.put("actor", "http://mastodon.example.org/users/admin") + |> put_in(["object", "actor"], "http://mastodon.example.org/users/admin") _recipient = insert(:user, ap_id: List.first(data["to"]), local: true) diff --git a/test/pleroma/web/activity_pub/transmogrifier_test.exs b/test/pleroma/web/activity_pub/transmogrifier_test.exs @@ -169,7 +169,7 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do {:ok, modified} = Transmogrifier.prepare_outgoing(announce_activity.data) assert modified["object"]["content"] == "hey" - assert activity.actor == modified["object"]["attributedTo"] + assert modified["object"]["actor"] == modified["object"]["attributedTo"] end test "it turns mentions into tags" do @@ -220,7 +220,7 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do {:ok, activity} = CommonAPI.post(user, %{status: "hey"}) {:ok, modified} = Transmogrifier.prepare_outgoing(activity.data) - assert activity.actor == modified["object"]["attributedTo"] + assert modified["object"]["actor"] == modified["object"]["attributedTo"] end test "it strips internal hashtag data" do @@ -266,7 +266,6 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do assert is_nil(modified["object"]["announcements"]) assert is_nil(modified["object"]["announcement_count"]) assert is_nil(modified["object"]["generator"]) - assert is_nil(modified["object"]["actor"]) end test "it strips internal fields of article" do