Drop unused "inReplyToAtomUri" in objects
authorHaelwenn (lanodan) Monnier <contact@hacktivis.me>
Tue, 8 Sep 2020 08:43:57 +0000 (10:43 +0200)
committerHaelwenn (lanodan) Monnier <contact@hacktivis.me>
Tue, 8 Sep 2020 16:43:57 +0000 (18:43 +0200)
lib/pleroma/web/activity_pub/transmogrifier.ex
test/web/activity_pub/transmogrifier_test.exs

index 0831efadcca99545fedf939ebd3e770ad2e97305..af4384213bf48c5558eb6b675ec32360c028adf0 100644 (file)
@@ -168,7 +168,6 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
   def fix_in_reply_to(%{"inReplyTo" => in_reply_to} = object, options)
       when not is_nil(in_reply_to) do
     in_reply_to_id = prepare_in_reply_to(in_reply_to)
-    object = Map.put(object, "inReplyToAtomUri", in_reply_to_id)
     depth = (options[:depth] || 0) + 1
 
     if Federator.allowed_thread_distance?(depth) do
@@ -176,9 +175,8 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
            %Activity{} <- Activity.get_create_by_object_ap_id(replied_object.data["id"]) do
         object
         |> Map.put("inReplyTo", replied_object.data["id"])
-        |> Map.put("inReplyToAtomUri", object["inReplyToAtomUri"] || in_reply_to_id)
         |> Map.put("context", replied_object.data["context"] || object["conversation"])
-        |> Map.drop(["conversation"])
+        |> Map.drop(["conversation", "inReplyToAtomUri"])
       else
         e ->
           Logger.warn("Couldn't fetch #{inspect(in_reply_to_id)}, error: #{inspect(e)}")
index 3fa41b0c71d088b548bcb2bbc0ff490e939e0a3c..6e096e9ec98e460d2dea1946f6d5b55c120a5a85 100644 (file)
@@ -116,7 +116,8 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do
                  "tag:shitposter.club,2017-05-05:noticeId=2827873:objectType=comment"
                )
 
-      assert returned_object.data["inReplyToAtomUri"] == "https://shitposter.club/notice/2827873"
+      assert returned_object.data["inReplyTo"] ==
+               "tag:shitposter.club,2017-05-05:noticeId=2827873:objectType=comment"
     end
 
     test "it does not fetch reply-to activities beyond max replies depth limit" do
@@ -140,8 +141,7 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do
                  "tag:shitposter.club,2017-05-05:noticeId=2827873:objectType=comment"
                )
 
-        assert returned_object.data["inReplyToAtomUri"] ==
-                 "https://shitposter.club/notice/2827873"
+        assert returned_object.data["inReplyTo"] == "https://shitposter.club/notice/2827873"
       end
     end
 
@@ -1072,7 +1072,7 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do
       assert Transmogrifier.fix_in_reply_to(data) == data
     end
 
-    test "returns object with inReplyToAtomUri when denied incoming reply", %{data: data} do
+    test "returns object with inReplyTo when denied incoming reply", %{data: data} do
       Pleroma.Config.put([:instance, :federation_incoming_replies_max_depth], 0)
 
       object_with_reply =
@@ -1080,26 +1080,22 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do
 
       modified_object = Transmogrifier.fix_in_reply_to(object_with_reply)
       assert modified_object["inReplyTo"] == "https://shitposter.club/notice/2827873"
-      assert modified_object["inReplyToAtomUri"] == "https://shitposter.club/notice/2827873"
 
       object_with_reply =
         Map.put(data["object"], "inReplyTo", %{"id" => "https://shitposter.club/notice/2827873"})
 
       modified_object = Transmogrifier.fix_in_reply_to(object_with_reply)
       assert modified_object["inReplyTo"] == %{"id" => "https://shitposter.club/notice/2827873"}
-      assert modified_object["inReplyToAtomUri"] == "https://shitposter.club/notice/2827873"
 
       object_with_reply =
         Map.put(data["object"], "inReplyTo", ["https://shitposter.club/notice/2827873"])
 
       modified_object = Transmogrifier.fix_in_reply_to(object_with_reply)
       assert modified_object["inReplyTo"] == ["https://shitposter.club/notice/2827873"]
-      assert modified_object["inReplyToAtomUri"] == "https://shitposter.club/notice/2827873"
 
       object_with_reply = Map.put(data["object"], "inReplyTo", [])
       modified_object = Transmogrifier.fix_in_reply_to(object_with_reply)
       assert modified_object["inReplyTo"] == []
-      assert modified_object["inReplyToAtomUri"] == ""
     end
 
     @tag capture_log: true
@@ -1117,8 +1113,6 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do
       assert modified_object["inReplyTo"] ==
                "tag:shitposter.club,2017-05-05:noticeId=2827873:objectType=comment"
 
-      assert modified_object["inReplyToAtomUri"] == "https://shitposter.club/notice/2827873"
-
       assert modified_object["context"] ==
                "tag:shitposter.club,2017-05-05:objectType=thread:nonce=3c16e9c2681f6d26"
     end