Small refactor.
authorlain <lain@soykaf.club>
Thu, 8 Nov 2018 15:05:28 +0000 (16:05 +0100)
committerlain <lain@soykaf.club>
Thu, 8 Nov 2018 15:05:28 +0000 (16:05 +0100)
lib/pleroma/web/activity_pub/views/object_view.ex
test/web/activity_pub/views/object_view_test.exs

index cc0b0556bcf3571b9e54d426d970ac756bbd0bf3..df734a871f76ae32ef64d66751abcd4c4eb58b64 100644 (file)
@@ -3,23 +3,7 @@ defmodule Pleroma.Web.ActivityPub.ObjectView do
   alias Pleroma.Web.ActivityPub.Transmogrifier
 
   def render("object.json", %{object: object}) do
-    base = %{
-      "@context" => [
-        "https://www.w3.org/ns/activitystreams",
-        "https://w3id.org/security/v1",
-        %{
-          "manuallyApprovesFollowers" => "as:manuallyApprovesFollowers",
-          "sensitive" => "as:sensitive",
-          "Hashtag" => "as:Hashtag",
-          "ostatus" => "http://ostatus.org#",
-          "atomUri" => "ostatus:atomUri",
-          "inReplyToAtomUri" => "ostatus:inReplyToAtomUri",
-          "conversation" => "ostatus:conversation",
-          "toot" => "http://joinmastodon.org/ns#",
-          "Emoji" => "toot:Emoji"
-        }
-      ]
-    }
+    base = Pleroma.Web.ActivityPub.Utils.make_json_ld_header()
 
     additional = Transmogrifier.prepare_object(object.data)
     Map.merge(base, additional)
index 6a1311be71cb2274d1fd189731ab07a4d3f4648b..7e08dff5d1551e4a8fed1dc92ffea5b81a4dae48 100644 (file)
@@ -13,5 +13,6 @@ defmodule Pleroma.Web.ActivityPub.ObjectViewTest do
     assert result["to"] == note.data["to"]
     assert result["content"] == note.data["content"]
     assert result["type"] == "Note"
+    assert result["@context"]
   end
 end