transmogrifier: pro-actively add support for Hashtag without array in tag
authorHaelwenn (lanodan) Monnier <contact@hacktivis.me>
Wed, 26 Sep 2018 08:21:58 +0000 (10:21 +0200)
committerHaelwenn (lanodan) Monnier <contact@hacktivis.me>
Thu, 27 Sep 2018 18:00:47 +0000 (20:00 +0200)
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