mirror of
https://git.pleroma.social/pleroma/pleroma.git
synced 2024-12-23 16:40:29 +00:00
[#3213] Made Object.object_data_hashtags/1 handle both AS2 and plain text hashtags.
This commit is contained in:
parent
e0b5edb6d5
commit
8d1a0c1afd
1 changed files with 3 additions and 1 deletions
|
@ -405,16 +405,18 @@ defmodule Pleroma.Object do
|
|||
defp embedded_hashtags(_), do: []
|
||||
|
||||
defp object_data_hashtags(%{"tag" => tags}) when is_list(tags) do
|
||||
# Note: Old format with copy of hashtags as strings is ignored, using AS2
|
||||
tags
|
||||
|> Enum.filter(fn
|
||||
%{"type" => "Hashtag"} = data -> Map.has_key?(data, "name")
|
||||
plain_text when is_bitstring(plain_text) -> true
|
||||
_ -> false
|
||||
end)
|
||||
|> Enum.map(fn
|
||||
%{"name" => "#" <> hashtag} -> String.downcase(hashtag)
|
||||
%{"name" => hashtag} -> String.downcase(hashtag)
|
||||
hashtag when is_bitstring(hashtag) -> String.downcase(hashtag)
|
||||
end)
|
||||
|> Enum.uniq()
|
||||
end
|
||||
|
||||
defp object_data_hashtags(_), do: []
|
||||
|
|
Loading…
Reference in a new issue