Merge branch 'fix/backup-url-on-s3' into 'develop'
[akkoma] / lib / pleroma / web / common_api / utils.ex
index 880b5d78f86965b617323960a31c2585696fbe2b..ddbdb33763d066e68faa2002c3156b92cf70b65a 100644 (file)
@@ -310,16 +310,7 @@ defmodule Pleroma.Web.CommonAPI.Utils do
       "context" => draft.context,
       "attachment" => draft.attachments,
       "actor" => draft.user.ap_id,
-      "tag" => Enum.filter(draft.tags, &is_map(&1)) |> Enum.uniq(),
-      "hashtags" =>
-        draft.tags
-        |> Enum.reduce([], fn
-          # Why so many formats
-          {:name, x}, acc -> if is_bitstring(x), do: [x | acc], else: acc
-          {"#" <> _, x}, acc -> if is_bitstring(x), do: [x | acc], else: acc
-          x, acc -> if is_bitstring(x), do: [x | acc], else: acc
-        end)
-        |> Enum.uniq()
+      "tag" => Keyword.values(draft.tags) |> Enum.uniq()
     }
     |> add_in_reply_to(draft.in_reply_to)
     |> Map.merge(draft.extra)
@@ -328,7 +319,7 @@ defmodule Pleroma.Web.CommonAPI.Utils do
   defp add_in_reply_to(object, nil), do: object
 
   defp add_in_reply_to(object, in_reply_to) do
-    with %Object{} = in_reply_to_object <- Object.normalize(in_reply_to) do
+    with %Object{} = in_reply_to_object <- Object.normalize(in_reply_to, fetch: false) do
       Map.put(object, "inReplyTo", in_reply_to_object.data["id"])
     else
       _ -> object
@@ -408,7 +399,7 @@ defmodule Pleroma.Web.CommonAPI.Utils do
         %Activity{data: %{"to" => _to, "type" => type} = data} = activity
       )
       when type == "Create" do
-    object = Object.normalize(activity, false)
+    object = Object.normalize(activity, fetch: false)
 
     object_data =
       cond do