diff options
author | Maxim Filippov <colixer@gmail.com> | 2019-07-24 02:42:28 +0300 |
---|---|---|
committer | Maxim Filippov <colixer@gmail.com> | 2019-07-24 02:42:28 +0300 |
commit | f46805bb40bf29cd67acb33b6b65ed1e4e28d3e1 (patch) | |
tree | 7542dbbe178183e4dd3c3451aa7744f18117fa37 /lib/mix/tasks | |
parent | 03471151d6089e318abaf5265d42ffedf7a5b902 (diff) | |
parent | 1a751529fb2cd3929e3373a908bec5db5cc32f1b (diff) | |
download | pleroma-f46805bb40bf29cd67acb33b6b65ed1e4e28d3e1.tar.gz |
Merge branch 'develop' into feature/admin-api-user-statuses
Diffstat (limited to 'lib/mix/tasks')
-rw-r--r-- | lib/mix/tasks/pleroma/user.ex | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/mix/tasks/pleroma/user.ex b/lib/mix/tasks/pleroma/user.ex index 8a78b4fe6..c9b84b8f9 100644 --- a/lib/mix/tasks/pleroma/user.ex +++ b/lib/mix/tasks/pleroma/user.ex @@ -62,6 +62,10 @@ defmodule Mix.Tasks.Pleroma.User do mix pleroma.user unsubscribe NICKNAME + ## Unsubscribe local users from an entire instance and deactivate all accounts + + mix pleroma.user unsubscribe_all_from_instance INSTANCE + ## Create a password reset link. mix pleroma.user reset_password NICKNAME @@ -246,6 +250,20 @@ defmodule Mix.Tasks.Pleroma.User do end end + def run(["unsubscribe_all_from_instance", instance]) do + start_pleroma() + + Pleroma.User.Query.build(%{nickname: "@#{instance}"}) + |> Pleroma.RepoStreamer.chunk_stream(500) + |> Stream.each(fn users -> + users + |> Enum.each(fn user -> + run(["unsubscribe", user.nickname]) + end) + end) + |> Stream.run() + end + def run(["set", nickname | rest]) do start_pleroma() |