fix: prevent sending group physical address if it's empty and allow empty text for timezone

As old addresses don't hold TZ information

Closes #1357

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2023-12-03 18:05:52 +01:00
parent 8795576865
commit 32caebb1d0
3 changed files with 8 additions and 2 deletions

View File

@@ -17,6 +17,8 @@ defmodule Mobilizon.GraphQL.Schema.Custom.Timezone do
@spec decode(Absinthe.Blueprint.Input.String.t()) :: {:ok, term} | :error
@spec decode(Absinthe.Blueprint.Input.Null.t()) :: {:ok, nil}
defp decode(%Absinthe.Blueprint.Input.String{value: ""}), do: {:ok, nil}
defp decode(%Absinthe.Blueprint.Input.String{value: value}) do
if Tzdata.zone_exists?(value),
do: {:ok, value},