Move object internal fields to a constant
authorrinpatch <rinpatch@sdf.org>
Wed, 18 Sep 2019 16:24:20 +0000 (19:24 +0300)
committerrinpatch <rinpatch@sdf.org>
Wed, 18 Sep 2019 16:24:20 +0000 (19:24 +0300)
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 8461b666e2c0ca641ec680540ed6b8f90099d99b..9d2ddc1cd75e094a9d2232a51561410e5786b1c7 100644 (file)
@@ -979,15 +979,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