mirror of
https://akkoma.dev/AkkomaGang/akkoma.git
synced 2024-11-10 02:05:12 +00:00
Transmogrifier: Refactor and unify incoming tag handling
This commit is contained in:
parent
39fd4d7639
commit
e97b254c6b
|
@ -323,14 +323,12 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
|
|||
Map.put(object, "tag", tag ++ tags)
|
||||
end
|
||||
|
||||
def fix_tag(%{"tag" => %{"type" => "Hashtag", "name" => hashtag} = tag} = object) do
|
||||
combined = [tag, String.slice(hashtag, 1..-1)]
|
||||
|
||||
Map.put(object, "tag", combined)
|
||||
def fix_tag(%{"tag" => %{} = tag} = object) do
|
||||
object
|
||||
|> Map.put("tag", [tag])
|
||||
|> fix_tag
|
||||
end
|
||||
|
||||
def fix_tag(%{"tag" => %{} = tag} = object), do: Map.put(object, "tag", [tag])
|
||||
|
||||
def fix_tag(object), do: object
|
||||
|
||||
# content map usually only has one language so this will do for now.
|
||||
|
|
Loading…
Reference in a new issue