Allow to properly move group resources

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2020-06-25 18:47:17 +02:00
parent fa5483f081
commit 39c03301c9
10 changed files with 298 additions and 19 deletions

View File

@@ -30,7 +30,16 @@ defmodule Mobilizon.Service.RichMedia.Parsers.OGP do
defp transform_tags(data) do
data
|> Map.put(:image_remote_url, Map.get(data, :image))
|> Map.put(:width, Map.get(data, :"image:width"))
|> Map.put(:height, Map.get(data, :"image:height"))
|> Map.put(:width, get_integer_value(data, :"image:width"))
|> Map.put(:height, get_integer_value(data, :"image:height"))
end
defp get_integer_value(data, key) do
with value <- Map.get(data, key),
{value, ""} <- Integer.parse(value) do
value
else
_ -> nil
end
end
end