Move object internal fields to a constant
authorrinpatch <rinpatch@sdf.org>
Wed, 18 Sep 2019 16:24:20 +0000 (19:24 +0300)
committerAriadne Conill <ariadne@dereferenced.org>
Sun, 6 Oct 2019 14:53:34 +0000 (14:53 +0000)
lib/pleroma/constants.ex
lib/pleroma/web/activity_pub/transmogrifier.ex

index ef14185435273507e5e699d959646bfb11fa99b2..0bf20cdd0ecb8b384b93b194ed3d73d043e2fbb6 100644 (file)
@@ -6,4 +6,16 @@ defmodule Pleroma.Constants do
   use Const
 
   const(as_public, do: "https://www.w3.org/ns/activitystreams#Public")
+
+  const(object_internal_fields,
+    do: [
+      "likes",
+      "like_count",
+      "announcements",
+      "announcement_count",
+      "emoji",
+      "context_id",
+      "deleted_activity_id"
+    ]
+  )
 end
index c3d0713938c5b5b97a7f00ee7466dfdadcb39b06..1c67fee2eb7f52dfc4e3fd38b8e5d2464681808e 100644 (file)
@@ -997,15 +997,7 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
 
   defp strip_internal_fields(object) do
     object
-    |> Map.drop([
-      "likes",
-      "like_count",
-      "announcements",
-      "announcement_count",
-      "emoji",
-      "context_id",
-      "deleted_activity_id"
-    ])
+    |> Map.drop(Pleroma.Constants.object_internal_fields())
   end
 
   defp strip_internal_tags(%{"tag" => tags} = object) do