mirror of
https://akkoma.dev/AkkomaGang/akkoma.git
synced 2024-11-13 04:34:47 +00:00
rename mix task: pleroma.user unsubscribe
-> pleroma.user deactivate
This commit is contained in:
parent
63477d07ad
commit
9bc5e18ade
3 changed files with 16 additions and 17 deletions
|
@ -95,33 +95,33 @@ mix pleroma.user sign_out <nickname>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
## Deactivate or activate a user
|
## Deactivate or activate a user
|
||||||
```sh tab="OTP"
|
```sh tab="OTP"
|
||||||
./bin/pleroma_ctl user toggle_activated <nickname>
|
./bin/pleroma_ctl user toggle_activated <nickname>
|
||||||
```
|
```
|
||||||
|
|
||||||
```sh tab="From Source"
|
```sh tab="From Source"
|
||||||
mix pleroma.user toggle_activated <nickname>
|
mix pleroma.user toggle_activated <nickname>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
## Unsubscribe local users from a user and deactivate the user
|
## Deactivate a user and unsubscribes local users from the user
|
||||||
```sh tab="OTP"
|
```sh tab="OTP"
|
||||||
./bin/pleroma_ctl user unsubscribe NICKNAME
|
./bin/pleroma_ctl user deactivate NICKNAME
|
||||||
```
|
```
|
||||||
|
|
||||||
```sh tab="From Source"
|
```sh tab="From Source"
|
||||||
mix pleroma.user unsubscribe NICKNAME
|
mix pleroma.user deactivate NICKNAME
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
## Unsubscribe local users from an instance and deactivate all accounts on it
|
## Deactivate all accounts from an instance and unsubscribe local users on it
|
||||||
```sh tab="OTP"
|
```sh tab="OTP"
|
||||||
./bin/pleroma_ctl user unsubscribe_all_from_instance <instance>
|
./bin/pleroma_ctl user deacitivate_all_from_instance <instance>
|
||||||
```
|
```
|
||||||
|
|
||||||
```sh tab="From Source"
|
```sh tab="From Source"
|
||||||
mix pleroma.user unsubscribe_all_from_instance <instance>
|
mix pleroma.user deactivate_all_from_instance <instance>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
@ -177,4 +177,3 @@ mix pleroma.user untag <nickname> <tags>
|
||||||
```sh tab="From Source"
|
```sh tab="From Source"
|
||||||
mix pleroma.user toggle_confirmed <nickname>
|
mix pleroma.user toggle_confirmed <nickname>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -144,7 +144,7 @@ defmodule Mix.Tasks.Pleroma.User do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def run(["unsubscribe", nickname]) do
|
def run(["deactivate", nickname]) do
|
||||||
start_pleroma()
|
start_pleroma()
|
||||||
|
|
||||||
with %User{} = user <- User.get_cached_by_nickname(nickname) do
|
with %User{} = user <- User.get_cached_by_nickname(nickname) do
|
||||||
|
@ -163,7 +163,7 @@ defmodule Mix.Tasks.Pleroma.User do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def run(["unsubscribe_all_from_instance", instance]) do
|
def run(["deactivate_all_from_instance", instance]) do
|
||||||
start_pleroma()
|
start_pleroma()
|
||||||
|
|
||||||
Pleroma.User.Query.build(%{nickname: "@#{instance}"})
|
Pleroma.User.Query.build(%{nickname: "@#{instance}"})
|
||||||
|
@ -171,7 +171,7 @@ defmodule Mix.Tasks.Pleroma.User do
|
||||||
|> Stream.each(fn users ->
|
|> Stream.each(fn users ->
|
||||||
users
|
users
|
||||||
|> Enum.each(fn user ->
|
|> Enum.each(fn user ->
|
||||||
run(["unsubscribe", user.nickname])
|
run(["deactivate", user.nickname])
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|> Stream.run()
|
|> Stream.run()
|
||||||
|
|
|
@ -169,7 +169,7 @@ defmodule Mix.Tasks.Pleroma.UserTest do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "running unsubscribe" do
|
describe "running deactivate" do
|
||||||
test "user is unsubscribed" do
|
test "user is unsubscribed" do
|
||||||
followed = insert(:user)
|
followed = insert(:user)
|
||||||
remote_followed = insert(:user, local: false)
|
remote_followed = insert(:user, local: false)
|
||||||
|
@ -178,7 +178,7 @@ defmodule Mix.Tasks.Pleroma.UserTest do
|
||||||
User.follow(user, followed, :follow_accept)
|
User.follow(user, followed, :follow_accept)
|
||||||
User.follow(user, remote_followed, :follow_accept)
|
User.follow(user, remote_followed, :follow_accept)
|
||||||
|
|
||||||
Mix.Tasks.Pleroma.User.run(["unsubscribe", user.nickname])
|
Mix.Tasks.Pleroma.User.run(["deactivate", user.nickname])
|
||||||
|
|
||||||
assert_received {:mix_shell, :info, [message]}
|
assert_received {:mix_shell, :info, [message]}
|
||||||
assert message =~ "Deactivating"
|
assert message =~ "Deactivating"
|
||||||
|
@ -192,8 +192,8 @@ defmodule Mix.Tasks.Pleroma.UserTest do
|
||||||
assert user.deactivated
|
assert user.deactivated
|
||||||
end
|
end
|
||||||
|
|
||||||
test "no user to unsubscribe" do
|
test "no user to deactivate" do
|
||||||
Mix.Tasks.Pleroma.User.run(["unsubscribe", "nonexistent"])
|
Mix.Tasks.Pleroma.User.run(["deactivate", "nonexistent"])
|
||||||
|
|
||||||
assert_received {:mix_shell, :error, [message]}
|
assert_received {:mix_shell, :error, [message]}
|
||||||
assert message =~ "No user"
|
assert message =~ "No user"
|
||||||
|
|
Loading…
Reference in a new issue