commit: e97b254c6bb798d200f381e5adbde2177bcbc0df
parent 39fd4d7639a0ab47bc5ae3839b10701fc301a1be
Author: lain <lain@soykaf.club>
Date: Mon, 19 Oct 2020 15:46:24 +0200
Transmogrifier: Refactor and unify incoming tag handling
Diffstat:
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/lib/pleroma/web/activity_pub/transmogrifier.ex b/lib/pleroma/web/activity_pub/transmogrifier.ex
@@ -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.