From eb61564005b743acefe7bb31c9369c38c9dfad6e Mon Sep 17 00:00:00 2001 From: "Haelwenn (lanodan) Monnier" Date: Fri, 17 Apr 2020 23:55:56 +0200 Subject: [PATCH 1/3] migrations/20200406100225_users_add_emoji: Fix tag to Emoji filtering, electric bongaloo --- lib/pleroma/web/activity_pub/activity_pub.ex | 5 ++++- priv/repo/migrations/20200406100225_users_add_emoji.exs | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/pleroma/web/activity_pub/activity_pub.ex b/lib/pleroma/web/activity_pub/activity_pub.ex index d403405a0..cb942c211 100644 --- a/lib/pleroma/web/activity_pub/activity_pub.ex +++ b/lib/pleroma/web/activity_pub/activity_pub.ex @@ -1430,7 +1430,10 @@ defp object_to_user_data(data) do emojis = data |> Map.get("tag", []) - |> Enum.filter(fn data -> data["type"] == "Emoji" and data["icon"] end) + |> Enum.filter(fn + %{"type" => t} -> t == "Emoji" + _ -> false + 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 9f57abb5c..f754502ae 100644 --- a/priv/repo/migrations/20200406100225_users_add_emoji.exs +++ b/priv/repo/migrations/20200406100225_users_add_emoji.exs @@ -17,7 +17,10 @@ def up do emoji = user.source_data |> Map.get("tag", []) - |> Enum.filter(fn data -> data["type"] == "Emoji" and data["icon"] end) + |> Enum.filter(fn + %{"type" => t} -> t == "Emoji" + _ -> false + end) |> Enum.reduce(%{}, fn %{"icon" => %{"url" => url}, "name" => name}, acc -> Map.put(acc, String.trim(name, ":"), url) end) From 24f760c2f732465151655fd4cd69cc149546b29f Mon Sep 17 00:00:00 2001 From: Haelwenn Date: Fri, 17 Apr 2020 22:48:37 +0000 Subject: [PATCH 2/3] Apply suggestion to lib/pleroma/web/activity_pub/activity_pub.ex --- lib/pleroma/web/activity_pub/activity_pub.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/pleroma/web/activity_pub/activity_pub.ex b/lib/pleroma/web/activity_pub/activity_pub.ex index cb942c211..eedea08a2 100644 --- a/lib/pleroma/web/activity_pub/activity_pub.ex +++ b/lib/pleroma/web/activity_pub/activity_pub.ex @@ -1431,7 +1431,7 @@ defp object_to_user_data(data) do data |> Map.get("tag", []) |> Enum.filter(fn - %{"type" => t} -> t == "Emoji" + %{"type" => "Emoji"} -> true _ -> false end) |> Enum.reduce(%{}, fn %{"icon" => %{"url" => url}, "name" => name}, acc -> From d698ecef9b5ede19474f1a45b776f8ad9f8b7678 Mon Sep 17 00:00:00 2001 From: Haelwenn Date: Fri, 17 Apr 2020 22:48:40 +0000 Subject: [PATCH 3/3] Apply suggestion to priv/repo/migrations/20200406100225_users_add_emoji.exs --- priv/repo/migrations/20200406100225_users_add_emoji.exs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/priv/repo/migrations/20200406100225_users_add_emoji.exs b/priv/repo/migrations/20200406100225_users_add_emoji.exs index f754502ae..f248108de 100644 --- a/priv/repo/migrations/20200406100225_users_add_emoji.exs +++ b/priv/repo/migrations/20200406100225_users_add_emoji.exs @@ -18,7 +18,7 @@ def up do user.source_data |> Map.get("tag", []) |> Enum.filter(fn - %{"type" => t} -> t == "Emoji" + %{"type" => "Emoji"} -> true _ -> false end) |> Enum.reduce(%{}, fn %{"icon" => %{"url" => url}, "name" => name}, acc ->