diff options
| author | kaniini <ariadne@dereferenced.org> | 2019-07-19 19:33:47 +0000 | 
|---|---|---|
| committer | kaniini <ariadne@dereferenced.org> | 2019-07-19 19:33:47 +0000 | 
| commit | c1c64d6d06fb7307245880d6605d9d9153a4784f (patch) | |
| tree | 8ddbd8451168b1cdc5cd16232b5ee7b5c4733eeb /lib/mix | |
| parent | 716afc83cec6b61a4111fd5c9ea74bf4a6c065ae (diff) | |
| parent | 9a8eb2c94d2243fadd69786eb74d94cc6116468f (diff) | |
| download | pleroma-c1c64d6d06fb7307245880d6605d9d9153a4784f.tar.gz pleroma-c1c64d6d06fb7307245880d6605d9d9153a4784f.zip  | |
Merge branch 'feature/mix-unsubscribe-all-from-instance' into 'develop'
mix: add pleroma.user unsubscribe_all_from_instance
See merge request pleroma/pleroma!1454
Diffstat (limited to 'lib/mix')
| -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()  | 
