Create Object.hashtags/1 wrapper
[akkoma] / lib / pleroma / object.ex
index 052ad413bd6c7b2897b3b5823a60f1b884f96394..00d561d1b9cd75a3497e0644afea58c65bfe0b0b 100644 (file)
@@ -344,4 +344,8 @@ defmodule Pleroma.Object do
 
   def self_replies(object, opts \\ []),
     do: replies(object, Keyword.put(opts, :self_only, true))
+
+  def hashtags(%{"hashtags" => hashtags}), do: hashtags || []
+  def hashtags(%{"tag" => tags}), do: Enum.filter(tags, &is_bitstring(&1))
+  def hashtags(_), do: []
 end