logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma git clone https://hacktivis.me/git/pleroma.git
commit: 75166607532723055ae24d5c9ac0e7f03160c913
parent a59e32f1dda3d35539b48a27224427e6230fe912
Author: Mark Felder <feld@FreeBSD.org>
Date:   Tue, 13 Oct 2020 16:44:27 -0500

Remove toggle_activation

Diffstat:

MCHANGELOG.md1+
Mdocs/administration/CLI_tasks/user.md15---------------
Mlib/mix/tasks/pleroma/user.ex15---------------
Mtest/mix/tasks/pleroma/user_test.exs33---------------------------------
4 files changed, 1 insertion(+), 63 deletions(-)

diff --git 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 @@ -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 === "OTP" diff --git 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 @@ -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)