From 75166607532723055ae24d5c9ac0e7f03160c913 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Tue, 13 Oct 2020 16:44:27 -0500 Subject: [PATCH] Remove toggle_activation --- CHANGELOG.md | 1 + docs/administration/CLI_tasks/user.md | 15 ------------ lib/mix/tasks/pleroma/user.ex | 15 ------------ test/mix/tasks/pleroma/user_test.exs | 33 --------------------------- 4 files changed, 1 insertion(+), 63 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 25b24bf07..9b50d577d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ### Changed +- **Breaking:** Removed the toggle_activated mix task - 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. - Improved registration workflow for email confirmation and account approval modes. diff --git a/docs/administration/CLI_tasks/user.md b/docs/administration/CLI_tasks/user.md index b57dce0e7..9fde9631e 100644 --- a/docs/administration/CLI_tasks/user.md +++ b/docs/administration/CLI_tasks/user.md @@ -134,21 +134,6 @@ ``` -## Deactivate or activate a user - -=== "OTP" - - ```sh - ./bin/pleroma_ctl user toggle_activated - ``` - -=== "From Source" - - ```sh - mix pleroma.user toggle_activated - ``` - - ## Deactivate a user and unsubscribes local users from the user === "OTP" diff --git a/lib/mix/tasks/pleroma/user.ex b/lib/mix/tasks/pleroma/user.ex index 9cd74efde..133daf0f0 100644 --- a/lib/mix/tasks/pleroma/user.ex +++ b/lib/mix/tasks/pleroma/user.ex @@ -107,21 +107,6 @@ defmodule Mix.Tasks.Pleroma.User do 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 start_pleroma() diff --git a/test/mix/tasks/pleroma/user_test.exs b/test/mix/tasks/pleroma/user_test.exs index fdf2ceec4..098052fe0 100644 --- a/test/mix/tasks/pleroma/user_test.exs +++ b/test/mix/tasks/pleroma/user_test.exs @@ -157,39 +157,6 @@ defmodule Mix.Tasks.Pleroma.UserTest do 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 test "user is unsubscribed" do followed = insert(:user)