Get config and display/hide register button

This commit is contained in:
Chocobozzz
2019-03-22 13:58:19 +01:00
parent e864b38ec6
commit 4fa78d7cd2
9 changed files with 48 additions and 48 deletions

View File

@@ -1,7 +1,20 @@
defmodule Mobilizon.CommonConfig do
def registrations_open?(), do: instance_config() |> get_in([:registrations_open])
@moduledoc """
Instance configuration wrapper
"""
def instance_name(), do: instance_config() |> get_in([:name])
def registrations_open?() do
instance_config()
|> get_in([:registrations_open])
|> to_bool
end
def instance_name() do
instance_config()
|> get_in([:name])
end
defp instance_config(), do: Application.get_env(:mobilizon, :instance)
defp to_bool(v), do: v == true or v == "true" or v == "True"
end

View File

@@ -2,7 +2,7 @@ defmodule MobilizonWeb.Resolvers.Config do
@moduledoc """
Handles the config-related GraphQL calls
"""
require Logger
import Mobilizon.CommonConfig
@doc """