Remove toggle_activation

This commit is contained in:
Mark Felder 2020-10-13 16:44:27 -05:00 committed by Mark Felder
parent a59e32f1dd
commit 7516660753
4 changed files with 1 additions and 63 deletions

View file

@ -8,6 +8,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
### Changed ### Changed
- **Breaking:** Removed the toggle_activated mix task
- Polls now always return a `voters_count`, even if they are single-choice. - Polls now always return a `voters_count`, even if they are single-choice.
- Admin Emails: The ap id is used as the user link in emails now. - Admin Emails: The ap id is used as the user link in emails now.
- Improved registration workflow for email confirmation and account approval modes. - Improved registration workflow for email confirmation and account approval modes.

View file

@ -134,21 +134,6 @@
``` ```
## Deactivate or activate a user
=== "OTP"
```sh
./bin/pleroma_ctl user toggle_activated <nickname>
```
=== "From Source"
```sh
mix pleroma.user toggle_activated <nickname>
```
## Deactivate a user and unsubscribes local users from the user ## Deactivate a user and unsubscribes local users from the user
=== "OTP" === "OTP"

View file

@ -107,21 +107,6 @@ defmodule Mix.Tasks.Pleroma.User do
end end
end end
def run(["toggle_activated", nickname]) do
start_pleroma()
with %User{} = user <- User.get_cached_by_nickname(nickname) do
{:ok, user} = User.deactivate(user, user.is_active)
shell_info(
"Activation status of #{nickname}: #{unless(user.is_active, do: "de", else: "")}activated"
)
else
_ ->
shell_error("No user #{nickname}")
end
end
def run(["reset_password", nickname]) do def run(["reset_password", nickname]) do
start_pleroma() start_pleroma()

View file

@ -157,39 +157,6 @@ defmodule Mix.Tasks.Pleroma.UserTest do
end end
end end
describe "running toggle_activated" do
test "user is deactivated" do
user = insert(:user)
Mix.Tasks.Pleroma.User.run(["toggle_activated", user.nickname])
assert_received {:mix_shell, :info, [message]}
assert message =~ " deactivated"
user = User.get_cached_by_nickname(user.nickname)
refute user.is_active
end
test "user is activated" do
user = insert(:user, is_active: false)
Mix.Tasks.Pleroma.User.run(["toggle_activated", user.nickname])
assert_received {:mix_shell, :info, [message]}
assert message =~ " activated"
user = User.get_cached_by_nickname(user.nickname)
assert user.is_active
end
test "no user to toggle" do
Mix.Tasks.Pleroma.User.run(["toggle_activated", "nonexistent"])
assert_received {:mix_shell, :error, [message]}
assert message =~ "No user"
end
end
describe "running deactivate" do describe "running deactivate" do
test "user is unsubscribed" do test "user is unsubscribed" do
followed = insert(:user) followed = insert(:user)