mastodon api: allow setting an account locked or not

This commit is contained in:
William Pitcock 2018-05-27 10:03:53 +00:00
parent ad7188fe92
commit a2c4a5a75b

View file

@ -72,6 +72,20 @@ def update_credentials(%{assigns: %{user: user}} = conn, params) do
user
end
user =
if locked = params["locked"] do
with locked <- locked == "true",
new_info <- Map.put(user.info, "locked", locked),
change <- User.info_changeset(user, %{info: new_info}),
{:ok, user} <- User.update_and_set_cache(change) do
user
else
_e -> user
end
else
user
end
with changeset <- User.update_changeset(user, params),
{:ok, user} <- User.update_and_set_cache(changeset) do
if original_user != user do