Format the code.

This commit is contained in:
lain 2018-03-30 15:01:53 +02:00
commit 4afbef39f4
111 changed files with 4912 additions and 2769 deletions

View file

@ -7,21 +7,24 @@ defmodule Mix.Tasks.SetModerator do
def run([nickname | rest]) do
ensure_started(Repo, [])
moderator = case rest do
[moderator] -> moderator == "true"
_ -> true
end
moderator =
case rest do
[moderator] -> moderator == "true"
_ -> true
end
with %User{local: true} = user <- User.get_by_nickname(nickname) do
info = user.info
|> Map.put("is_moderator", !!moderator)
info =
user.info
|> Map.put("is_moderator", !!moderator)
cng = User.info_changeset(user, %{info: info})
user = Repo.update!(cng)
IO.puts "Moderator status of #{nickname}: #{user.info["is_moderator"]}"
IO.puts("Moderator status of #{nickname}: #{user.info["is_moderator"]}")
else
_ ->
IO.puts "No local user #{nickname}"
IO.puts("No local user #{nickname}")
end
end
end