migrations/20200406100225_users_add_emoji: Fix tag to Emoji filtering
This commit is contained in:
parent
d8142ee6fe
commit
46f051048f
|
@ -1430,7 +1430,7 @@ defp object_to_user_data(data) do
|
||||||
emojis =
|
emojis =
|
||||||
data
|
data
|
||||||
|> Map.get("tag", [])
|
|> 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 ->
|
|> Enum.reduce(%{}, fn %{"icon" => %{"url" => url}, "name" => name}, acc ->
|
||||||
Map.put(acc, String.trim(name, ":"), url)
|
Map.put(acc, String.trim(name, ":"), url)
|
||||||
end)
|
end)
|
||||||
|
|
|
@ -17,7 +17,7 @@ def up do
|
||||||
emoji =
|
emoji =
|
||||||
user.source_data
|
user.source_data
|
||||||
|> Map.get("tag", [])
|
|> 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 ->
|
|> Enum.reduce(%{}, fn %{"icon" => %{"url" => url}, "name" => name}, acc ->
|
||||||
Map.put(acc, String.trim(name, ":"), url)
|
Map.put(acc, String.trim(name, ":"), url)
|
||||||
end)
|
end)
|
||||||
|
|
Loading…
Reference in New Issue