aboutsummaryrefslogtreecommitdiff
path: root/lib/mix/tasks
diff options
context:
space:
mode:
authorRoman Chvanikov <chvanikoff@pm.me>2019-07-20 01:03:25 +0300
committerRoman Chvanikov <chvanikoff@pm.me>2019-07-20 01:03:25 +0300
commit36049f08efadb5f6f727753ecc1f7be6a5b4e3d8 (patch)
tree2f1e1b5a20ad654cda4021115e621887d2735959 /lib/mix/tasks
parente7c175c943e9e3f53df76d812c09cfeffdb1c56b (diff)
parent33729bbb2834bfa1f223b11d47dc8e3230d47657 (diff)
downloadpleroma-36049f08efadb5f6f727753ecc1f7be6a5b4e3d8.tar.gz
Merge develop
Diffstat (limited to 'lib/mix/tasks')
-rw-r--r--lib/mix/tasks/pleroma/user.ex18
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()