Create Object.hashtags/1 wrapper

This commit is contained in:
Haelwenn (lanodan) Monnier 2020-12-22 03:54:57 +01:00
commit 87b13c5430
No known key found for this signature in database
GPG key ID: D5B7A8E43C997DEE
7 changed files with 20 additions and 20 deletions

View 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