Merge branch 'fix-admin-settings' into 'master'

Fix admin settings

See merge request framasoft/mobilizon!457
This commit is contained in:
Thomas Citharel 2020-06-09 17:59:24 +02:00
commit 55e22acbfc
2 changed files with 10 additions and 2 deletions

View File

@ -105,7 +105,7 @@
<script lang="ts">
import { Component, Vue } from "vue-property-decorator";
import { ADMIN_SETTINGS, SAVE_ADMIN_SETTINGS } from "@/graphql/admin";
import { IAdminSettings, InstanceTermsType } from "@/types/admin.model";
import { IAdminSettings, InstanceTermsType } from "../../types/admin.model";
import RouteName from "../../router/name";
@Component({

View File

@ -157,7 +157,15 @@ defmodule Mobilizon.GraphQL.Resolvers.Admin do
when is_admin(role) do
with {:ok, res} <- Admin.save_settings("instance", args) do
res =
res |> Enum.map(fn {key, %Setting{value: value}} -> {key, value} end) |> Enum.into(%{})
res
|> Enum.map(fn {key, %Setting{value: value}} ->
case value do
"true" -> {key, true}
"false" -> {key, false}
value -> {key, value}
end
end)
|> Enum.into(%{})
Config.clear_config_cache()