transmogrifier: pro-actively add support for Hashtag without array in tag
[akkoma] / lib / pleroma / web / activity_pub / transmogrifier.ex
index ed5df6f7bd773f267e4944cc35dae07587f17e36..291d7d16920ebcf062b62ed1e49d8b7c66498e21 100644 (file)
@@ -206,6 +206,13 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
     |> Map.put("tag", combined)
   end
 
+  def fix_tag(%{"tag" => %{"type" => "Hashtag"} = tag} = object) do
+    combined = [tag ++ String.slice(tag["name"], 1..-1)]
+
+    object
+    |> Map.put("tag", combined)
+  end
+
   def fix_tag(object) do
     object
   end