activitypub: normalize objects when streaming them out
authorWilliam Pitcock <nenolod@dereferenced.org>
Sun, 25 Nov 2018 20:09:28 +0000 (20:09 +0000)
committerWilliam Pitcock <nenolod@dereferenced.org>
Tue, 4 Dec 2018 04:52:09 +0000 (04:52 +0000)
lib/pleroma/web/activity_pub/activity_pub.ex

index 7e207c6201b1eb330c9c4737cfb437dd5a051ef4..b11d3221f14f7c9d44edc39b707451f486452c3b 100644 (file)
@@ -81,6 +81,8 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
     public = "https://www.w3.org/ns/activitystreams#Public"
 
     if activity.data["type"] in ["Create", "Announce"] do
+      object = Object.normalize(activity.data["object"])
+
       Pleroma.Web.Streamer.stream("user", activity)
       Pleroma.Web.Streamer.stream("list", activity)
 
@@ -91,12 +93,12 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
           Pleroma.Web.Streamer.stream("public:local", activity)
         end
 
-        activity.data["object"]
+        object.data
         |> Map.get("tag", [])
         |> Enum.filter(fn tag -> is_bitstring(tag) end)
         |> Enum.map(fn tag -> Pleroma.Web.Streamer.stream("hashtag:" <> tag, activity) end)
 
-        if activity.data["object"]["attachment"] != [] do
+        if object.data["attachment"] != [] do
           Pleroma.Web.Streamer.stream("public:media", activity)
 
           if activity.local do