common api: fetch visibility from normalized object
authorWilliam Pitcock <nenolod@dereferenced.org>
Sun, 25 Nov 2018 18:57:38 +0000 (18:57 +0000)
committerWilliam Pitcock <nenolod@dereferenced.org>
Tue, 4 Dec 2018 04:52:09 +0000 (04:52 +0000)
lib/pleroma/web/common_api/common_api.ex

index e3385310fc25ceb8d1d2ce499a6f431c2abfb8ea..e0c9dedd5ca8d8b4300a61b18227bc057d2d99ab 100644 (file)
@@ -64,7 +64,10 @@ defmodule Pleroma.Web.CommonAPI do
         "public"
 
       inReplyTo ->
-        Pleroma.Web.MastodonAPI.StatusView.get_visibility(inReplyTo.data["object"])
+        # XXX: these heuristics should be moved out of MastodonAPI.
+        with %Object{} = object <- Object.normalize(inReplyTo.data["object"]) do
+          Pleroma.Web.MastodonAPI.StatusView.get_visibility(object.data)
+        end
     end
   end