[#3213] Fixed Object.object_data_hashtags/1 to process only AS2 elements of `data.tag` (basing on #2984).
This commit is contained in:
parent
a25c1e8ec0
commit
e0b5edb6d5
|
@ -405,8 +405,16 @@ defp embedded_hashtags(%Object{data: data}) do
|
||||||
defp embedded_hashtags(_), do: []
|
defp embedded_hashtags(_), do: []
|
||||||
|
|
||||||
defp object_data_hashtags(%{"tag" => tags}) when is_list(tags) do
|
defp object_data_hashtags(%{"tag" => tags}) when is_list(tags) do
|
||||||
# Note: AS2 map-type elements are ignored
|
# Note: Old format with copy of hashtags as strings is ignored, using AS2
|
||||||
Enum.filter(tags, &is_bitstring(&1))
|
tags
|
||||||
|
|> Enum.filter(fn
|
||||||
|
%{"type" => "Hashtag"} = data -> Map.has_key?(data, "name")
|
||||||
|
_ -> false
|
||||||
|
end)
|
||||||
|
|> Enum.map(fn
|
||||||
|
%{"name" => "#" <> hashtag} -> String.downcase(hashtag)
|
||||||
|
%{"name" => hashtag} -> String.downcase(hashtag)
|
||||||
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
defp object_data_hashtags(_), do: []
|
defp object_data_hashtags(_), do: []
|
||||||
|
|
Loading…
Reference in New Issue