mix: add pleroma.user unsubscribe_all_from_instance
This commit is contained in:
parent
716afc83ce
commit
9a8eb2c94d
@ -62,6 +62,10 @@ defmodule Mix.Tasks.Pleroma.User do
|
|||||||
|
|
||||||
mix pleroma.user unsubscribe NICKNAME
|
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.
|
## Create a password reset link.
|
||||||
|
|
||||||
mix pleroma.user reset_password NICKNAME
|
mix pleroma.user reset_password NICKNAME
|
||||||
@ -246,6 +250,20 @@ def run(["unsubscribe", nickname]) do
|
|||||||
end
|
end
|
||||||
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
|
def run(["set", nickname | rest]) do
|
||||||
start_pleroma()
|
start_pleroma()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user