[#3213] Made Object.hashtags/1 work with :hashtags assoc. Adjusted tests.
This commit is contained in:
parent
4134abef63
commit
14fae94c0e
4 changed files with 29 additions and 14 deletions
|
|
@ -384,7 +384,19 @@ defmodule Pleroma.Object do
|
|||
|
||||
def tags(_), do: []
|
||||
|
||||
def hashtags(object), do: embedded_hashtags(object)
|
||||
def hashtags(%Object{} = object) do
|
||||
cond do
|
||||
Config.object_embedded_hashtags?() ->
|
||||
embedded_hashtags(object)
|
||||
|
||||
object.id == "pleroma:fake_object_id" ->
|
||||
[]
|
||||
|
||||
true ->
|
||||
hashtag_records = Repo.preload(object, :hashtags).hashtags
|
||||
Enum.map(hashtag_records, & &1.name)
|
||||
end
|
||||
end
|
||||
|
||||
defp embedded_hashtags(%Object{data: data}) do
|
||||
object_data_hashtags(data)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue