From 46f051048fb1afb02fe81b872ae9f595f2c5f2c1 Mon Sep 17 00:00:00 2001 From: "Haelwenn (lanodan) Monnier" Date: Fri, 17 Apr 2020 14:32:15 +0200 Subject: [PATCH] migrations/20200406100225_users_add_emoji: Fix tag to Emoji filtering --- lib/pleroma/web/activity_pub/activity_pub.ex | 2 +- priv/repo/migrations/20200406100225_users_add_emoji.exs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/pleroma/web/activity_pub/activity_pub.ex b/lib/pleroma/web/activity_pub/activity_pub.ex index 35af0f7dc..d403405a0 100644 --- a/lib/pleroma/web/activity_pub/activity_pub.ex +++ b/lib/pleroma/web/activity_pub/activity_pub.ex @@ -1430,7 +1430,7 @@ defp object_to_user_data(data) 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) diff --git a/priv/repo/migrations/20200406100225_users_add_emoji.exs b/priv/repo/migrations/20200406100225_users_add_emoji.exs index d0254c170..9f57abb5c 100644 --- a/priv/repo/migrations/20200406100225_users_add_emoji.exs +++ b/priv/repo/migrations/20200406100225_users_add_emoji.exs @@ -17,7 +17,7 @@ def up 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)