diff options
author | Hélène <pleroma-dev@helene.moe> | 2022-09-11 04:54:04 +0200 |
---|---|---|
committer | Hélène <pleroma-dev@helene.moe> | 2022-09-11 04:54:04 +0200 |
commit | 0b19625bfba0ef4a9a4c97bada981dfb5c1edbf4 (patch) | |
tree | 6f225d6693667e00284bfd688ffbc0057ec63893 /test/pleroma | |
parent | 453a66f8c268580148475e11a7d4141ac7e93515 (diff) | |
download | pleroma-0b19625bfba0ef4a9a4c97bada981dfb5c1edbf4.tar.gz |
ObjectView: do not fetch an object for its ID
Non-Create/Listen activities had their associated object field
normalized and fetched, but only to use their `id` field, which is both
slow and redundant. This also failed on Undo activities, which delete
the associated object/activity in database.
Undo activities will now render properly and database loads should
improve ever so slightly.
Diffstat (limited to 'test/pleroma')
-rw-r--r-- | test/pleroma/web/activity_pub/views/object_view_test.exs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/pleroma/web/activity_pub/views/object_view_test.exs b/test/pleroma/web/activity_pub/views/object_view_test.exs index 48a4b47c4..d94878e31 100644 --- a/test/pleroma/web/activity_pub/views/object_view_test.exs +++ b/test/pleroma/web/activity_pub/views/object_view_test.exs @@ -81,4 +81,18 @@ defmodule Pleroma.Web.ActivityPub.ObjectViewTest do assert result["object"] == object.data["id"] assert result["type"] == "Announce" end + + test "renders an undo announce activity" do + note = insert(:note_activity) + user = insert(:user) + + {:ok, announce} = CommonAPI.repeat(note.id, user) + {:ok, undo} = CommonAPI.unrepeat(note.id, user) + + result = ObjectView.render("object.json", %{object: undo}) + + assert result["id"] == undo.data["id"] + assert result["object"] == announce.data["id"] + assert result["type"] == "Undo" + end end |