[Pleroma.Web.ActivityPub.Transmogrifier]: Fix when inReplyTo is a inlined post [kroeg]
authorHaelwenn (lanodan) Monnier <contact@hacktivis.me>
Fri, 21 Sep 2018 10:43:35 +0000 (12:43 +0200)
committerHaelwenn (lanodan) Monnier <contact@hacktivis.me>
Thu, 27 Sep 2018 18:00:46 +0000 (20:00 +0200)
lib/pleroma/web/activity_pub/transmogrifier.ex

index 48c3aec970cbbfc2a8049ee67513a590123aa334..3af3efbb3779d91b2a1dcbf226ee5e22433e566d 100644 (file)
@@ -96,8 +96,17 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
     object
   end
 
-  def fix_in_reply_to(%{"inReplyTo" => in_reply_to_id} = object)
-      when not is_nil(in_reply_to_id) do
+  def fix_in_reply_to(%{"inReplyTo" => in_reply_to} = object)
+      when not is_nil(in_reply_to) do
+    in_reply_to_id =
+      if is_bitstring(in_reply_to) do
+        in_reply_to
+      else
+        if is_map(in_reply_to) && in_reply_to["id"] do
+          in_reply_to["id"]
+        end
+      end
+
     case ActivityPub.fetch_object_from_id(in_reply_to_id) do
       {:ok, replied_object} ->
         with %Activity{} = activity <-