Move from Schema.org Place to AS Place with Schema.org properties
See https://socialhub.activitypub.rocks/t/how-to-represent-places-in-an-event/413 Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
parent
8bfa95bdd0
commit
814c9ab53b
|
@ -35,11 +35,11 @@ defmodule Mobilizon.Service.ActivityPub.Converter.Address do
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
if is_nil(object["geo"]) do
|
if is_nil(object["latitude"]) or is_nil(object["longitude"]) do
|
||||||
res
|
res
|
||||||
else
|
else
|
||||||
geo = %Geo.Point{
|
geo = %Geo.Point{
|
||||||
coordinates: {object["geo"]["latitude"], object["geo"]["longitude"]},
|
coordinates: {object["latitude"], object["longitude"]},
|
||||||
srid: 4326
|
srid: 4326
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,11 +70,9 @@ defmodule Mobilizon.Service.ActivityPub.Converter.Address do
|
||||||
if is_nil(address.geom) do
|
if is_nil(address.geom) do
|
||||||
res
|
res
|
||||||
else
|
else
|
||||||
Map.put(res, "geo", %{
|
res
|
||||||
"type" => "GeoCoordinates",
|
|> Map.put("latitude", address.geom.coordinates |> elem(0))
|
||||||
"latitude" => address.geom.coordinates |> elem(0),
|
|> Map.put("longitude", address.geom.coordinates |> elem(1))
|
||||||
"longitude" => address.geom.coordinates |> elem(1)
|
|
||||||
})
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -41,17 +41,11 @@ defmodule Mobilizon.Service.ActivityPub.Utils do
|
||||||
"@id" => "sc:location",
|
"@id" => "sc:location",
|
||||||
"@type" => "sc:Place"
|
"@type" => "sc:Place"
|
||||||
},
|
},
|
||||||
"Place" => "sc:Place",
|
|
||||||
"PostalAddress" => "sc:PostalAddress",
|
"PostalAddress" => "sc:PostalAddress",
|
||||||
"GeoCoordinates" => "sc:GeoCoordinates",
|
|
||||||
"address" => %{
|
"address" => %{
|
||||||
"@id" => "sc:address",
|
"@id" => "sc:address",
|
||||||
"@type" => "sc:PostalAddress"
|
"@type" => "sc:PostalAddress"
|
||||||
},
|
},
|
||||||
"geo" => %{
|
|
||||||
"@id" => "sc:geo",
|
|
||||||
"@type" => "sc:GeoCoordinates"
|
|
||||||
},
|
|
||||||
"addressCountry" => "sc:addressCountry",
|
"addressCountry" => "sc:addressCountry",
|
||||||
"addressRegion" => "sc:addressRegion",
|
"addressRegion" => "sc:addressRegion",
|
||||||
"postalCode" => "sc:postalCode",
|
"postalCode" => "sc:postalCode",
|
||||||
|
|
Loading…
Reference in a new issue