Remove toggle_activation
authorMark Felder <feld@FreeBSD.org>
Tue, 13 Oct 2020 21:44:27 +0000 (16:44 -0500)
committerMark Felder <feld@feld.me>
Fri, 15 Jan 2021 17:25:32 +0000 (11:25 -0600)
CHANGELOG.md
docs/administration/CLI_tasks/user.md
lib/mix/tasks/pleroma/user.ex
test/mix/tasks/pleroma/user_test.exs

index 25b24bf07a660bb912f7122748fab7a0f8d9bcfb..9b50d577dfabdcd4a45b90e3b6dd41977145bd1d 100644 (file)
@@ -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.
index b57dce0e7f07e2f5751f7785ec3e33fc21a29d8f..9fde9631e06d565a23b4a44ec402362a6bb13dfd 100644 (file)
     ```
 
 
-## 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
 
 === "OTP"
index 9cd74efde9d90494739c9b35508e8f18bb886a44..133daf0f01322e9676d9eae7c4ab9181279cbeac 100644 (file)
@@ -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()
 
index fdf2ceec4a82d61c2ff47e8f1faeac219d985f7b..098052fe08a32eeb4a6a2ca7b19a463fba99f5d2 100644 (file)
@@ -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)