migrations/20200406100225_users_add_emoji: Fix tag to Emoji filtering
authorHaelwenn (lanodan) Monnier <contact@hacktivis.me>
Fri, 17 Apr 2020 12:32:15 +0000 (14:32 +0200)
committerHaelwenn (lanodan) Monnier <contact@hacktivis.me>
Fri, 17 Apr 2020 12:32:15 +0000 (14:32 +0200)
lib/pleroma/web/activity_pub/activity_pub.ex
priv/repo/migrations/20200406100225_users_add_emoji.exs

index 35af0f7dc7f3a0f8d83b4f812dcbaecebb77dab0..d403405a0d3547139a0e97af5cd0474254e3e963 100644 (file)
@@ -1430,7 +1430,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
     emojis =
       data
       |> Map.get("tag", [])
-      |> Enum.filter(fn %{"type" => t} -> t == "Emoji" end)
+      |> Enum.filter(fn data -> data["type"] == "Emoji" and data["icon"] end)
       |> Enum.reduce(%{}, fn %{"icon" => %{"url" => url}, "name" => name}, acc ->
         Map.put(acc, String.trim(name, ":"), url)
       end)
index d0254c170b521978aacaf46a9b73210abb7ce9e3..9f57abb5c3bac85d9a72bfd0865f9db61be40326 100644 (file)
@@ -17,7 +17,7 @@ defmodule Pleroma.Repo.Migrations.UsersPopulateEmoji do
       emoji =
         user.source_data
         |> Map.get("tag", [])
-        |> Enum.filter(fn %{"type" => t} -> t == "Emoji" end)
+        |> Enum.filter(fn data -> data["type"] == "Emoji" and data["icon"] end)
         |> Enum.reduce(%{}, fn %{"icon" => %{"url" => url}, "name" => name}, acc ->
           Map.put(acc, String.trim(name, ":"), url)
         end)