diff options
author | Mark Felder <feld@FreeBSD.org> | 2019-07-19 16:55:10 -0500 |
---|---|---|
committer | Mark Felder <feld@FreeBSD.org> | 2019-07-19 16:55:10 -0500 |
commit | 9169f331b6d481a0aa2b0bfe91500d695fb1b6d6 (patch) | |
tree | 734ce297aef5a2482c88cdc7d03914943ba4cf28 /lib/mix/tasks | |
parent | 46c7c53fbbfd9919d429ba15988af0da9e22d444 (diff) | |
parent | c1c64d6d06fb7307245880d6605d9d9153a4784f (diff) | |
download | pleroma-9169f331b6d481a0aa2b0bfe91500d695fb1b6d6.tar.gz pleroma-9169f331b6d481a0aa2b0bfe91500d695fb1b6d6.zip |
Merge branch 'develop' into feature/matstodon-statuses-by-name
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() |