aboutsummaryrefslogtreecommitdiff
path: root/lib/mix
diff options
context:
space:
mode:
Diffstat (limited to 'lib/mix')
-rw-r--r--lib/mix/pleroma.ex5
-rw-r--r--lib/mix/tasks/pleroma/user.ex18
2 files changed, 23 insertions, 0 deletions
diff --git a/lib/mix/pleroma.ex b/lib/mix/pleroma.ex
index faeb30e1d..73a076a53 100644
--- a/lib/mix/pleroma.ex
+++ b/lib/mix/pleroma.ex
@@ -6,6 +6,11 @@ defmodule Mix.Pleroma do
@doc "Common functions to be reused in mix tasks"
def start_pleroma do
Application.put_env(:phoenix, :serve_endpoints, false, persistent: true)
+
+ if Pleroma.Config.get(:env) != :test do
+ Application.put_env(:logger, :console, level: :debug)
+ end
+
{:ok, _} = Application.ensure_all_started(:pleroma)
end
diff --git a/lib/mix/tasks/pleroma/user.ex b/lib/mix/tasks/pleroma/user.ex
index 4e3b80db3..bc8eacda8 100644
--- a/lib/mix/tasks/pleroma/user.ex
+++ b/lib/mix/tasks/pleroma/user.ex
@@ -364,6 +364,24 @@ defmodule Mix.Tasks.Pleroma.User do
end
end
+ def run(["list"]) do
+ start_pleroma()
+
+ Pleroma.User.Query.build(%{local: true})
+ |> Pleroma.RepoStreamer.chunk_stream(500)
+ |> Stream.each(fn users ->
+ users
+ |> Enum.each(fn user ->
+ shell_info(
+ "#{user.nickname} moderator: #{user.info.is_moderator}, admin: #{user.info.is_admin}, locked: #{
+ user.info.locked
+ }, deactivated: #{user.info.deactivated}"
+ )
+ end)
+ end)
+ |> Stream.run()
+ end
+
defp set_moderator(user, value) do
{:ok, user} =
user