Fix geocoordinates mixmatch

Closes #828

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2021-08-16 10:23:16 +02:00
parent 22b2a4aff8
commit 34e2c4f310
No known key found for this signature in database
GPG key ID: A061B9DDE0CA0773
2 changed files with 3 additions and 3 deletions

View file

@ -40,7 +40,7 @@ defmodule Mobilizon.Federation.ActivityStream.Converter.Address do
res res
else else
geo = %Geo.Point{ geo = %Geo.Point{
coordinates: {object["latitude"], object["longitude"]}, coordinates: {object["longitude"], object["latitude"]},
srid: 4326 srid: 4326
} }
@ -72,8 +72,8 @@ defmodule Mobilizon.Federation.ActivityStream.Converter.Address do
res res
else else
res res
|> Map.put("latitude", address.geom.coordinates |> elem(0))
|> Map.put("longitude", address.geom.coordinates |> elem(1)) |> Map.put("longitude", address.geom.coordinates |> elem(1))
|> Map.put("latitude", address.geom.coordinates |> elem(0))
end end
end end
end end

View file

@ -76,7 +76,7 @@ defmodule Mobilizon.Addresses.Address do
def coords(nil), do: nil def coords(nil), do: nil
def coords(%__MODULE__{} = address) do def coords(%__MODULE__{} = address) do
with %Geo.Point{coordinates: {latitude, longitude}, srid: 4326} <- address.geom do with %Geo.Point{coordinates: {longitude, latitude}, srid: 4326} <- address.geom do
{latitude, longitude} {latitude, longitude}
end end
end end