Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2020-06-16 18:02:53 +02:00
parent 5cb3f478ae
commit 7cd45a1351
No known key found for this signature in database
GPG key ID: A061B9DDE0CA0773

View file

@ -479,9 +479,9 @@ defmodule Mobilizon.GraphQL.Resolvers.User do
end
def update_locale(_parent, %{locale: locale}, %{
context: %{current_user: %User{id: logged_user_id, locale: current_locale} = user}
context: %{current_user: %User{locale: current_locale} = user}
}) do
with true == current_locale != locale,
with true <- current_locale != locale,
{:ok, %User{} = updated_user} <- Users.update_user(user, %{locale: locale}) do
{:ok, updated_user}
end