Pleroma.Object/1: take %Object{} as argument instead
[akkoma] / lib / pleroma / activity / ir / topics.ex
index 2cdecf1e4c67e667be717d0e5d28cae6ad810efa..b7553c72857a70549ee61e910ddd4d1d33b3cea4 100644 (file)
@@ -48,18 +48,12 @@ defmodule Pleroma.Activity.Ir.Topics do
     tags
   end
 
-  defp hashtags_to_topics(%{data: %{"hashtags" => tags}}) do
-    Enum.map(tags, fn tag -> "hashtag:" <> tag end)
-  end
-
-  defp hashtags_to_topics(%{data: %{"tag" => tags}}) do
-    tags
-    |> Enum.filter(&is_bitstring(&1))
+  defp hashtags_to_topics(object) do
+    object
+    |> Object.hashtags()
     |> Enum.map(fn tag -> "hashtag:" <> tag end)
   end
 
-  defp hashtags_to_topics(_), do: []
-
   defp remote_topics(%{local: true}), do: []
 
   defp remote_topics(%{actor: actor}) when is_binary(actor),