Merge branch 'bugfix/1697-user_emoji_miration' into 'develop'

migrations/20200406100225_users_add_emoji: Fix tag to Emoji filtering, electric bongaloo

Closes #1697

See merge request pleroma/pleroma!2403
This commit is contained in:
Haelwenn 2020-04-18 06:59:23 +00:00
commit 79445ae5d2
2 changed files with 8 additions and 2 deletions

View File

@ -1430,7 +1430,10 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
emojis =
data
|> Map.get("tag", [])
|> Enum.filter(fn data -> data["type"] == "Emoji" and data["icon"] end)
|> Enum.filter(fn
%{"type" => "Emoji"} -> true
_ -> false
end)
|> Enum.reduce(%{}, fn %{"icon" => %{"url" => url}, "name" => name}, acc ->
Map.put(acc, String.trim(name, ":"), url)
end)

View File

@ -17,7 +17,10 @@ defmodule Pleroma.Repo.Migrations.UsersPopulateEmoji do
emoji =
user.source_data
|> Map.get("tag", [])
|> Enum.filter(fn data -> data["type"] == "Emoji" and data["icon"] end)
|> Enum.filter(fn
%{"type" => "Emoji"} -> true
_ -> false
end)
|> Enum.reduce(%{}, fn %{"icon" => %{"url" => url}, "name" => name}, acc ->
Map.put(acc, String.trim(name, ":"), url)
end)