mirror of
https://framagit.org/framasoft/mobilizon.git
synced 2025-03-12 17:42:53 +00:00
#1629: remove GeoIP for default location
This commit is contained in:
parent
ed85ae2bee
commit
fbcca23057
1 changed files with 2 additions and 16 deletions
|
@ -14,22 +14,8 @@ defmodule Mobilizon.GraphQL.Resolvers.Config do
|
||||||
Gets config.
|
Gets config.
|
||||||
"""
|
"""
|
||||||
@spec get_config(any(), map(), Absinthe.Resolution.t()) :: {:ok, map()}
|
@spec get_config(any(), map(), Absinthe.Resolution.t()) :: {:ok, map()}
|
||||||
def get_config(_parent, _params, %{context: %{ip: ip}}) do
|
def get_config(_parent, _params, %{context: %{}}) do
|
||||||
geolix = Geolix.lookup(ip)
|
data = Map.merge(config_cache(), %{})
|
||||||
|
|
||||||
country_code =
|
|
||||||
case Map.get(geolix, :city) do
|
|
||||||
%{country: %{iso_code: country_code}} -> String.downcase(country_code)
|
|
||||||
_ -> nil
|
|
||||||
end
|
|
||||||
|
|
||||||
location =
|
|
||||||
case Map.get(geolix, :city) do
|
|
||||||
%{location: location} -> location
|
|
||||||
_ -> nil
|
|
||||||
end
|
|
||||||
|
|
||||||
data = Map.merge(config_cache(), %{location: location, country_code: country_code})
|
|
||||||
|
|
||||||
{:ok, data}
|
{:ok, data}
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue