Format the code.
This commit is contained in:
parent
480932c8e5
commit
4afbef39f4
111 changed files with 4912 additions and 2769 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue