From 9bc5e18adeef2c68c5fae2435ed01555f1b29c93 Mon Sep 17 00:00:00 2001 From: Maksim Pechnikov Date: Thu, 21 May 2020 08:06:57 +0300 Subject: [PATCH] rename mix task: `pleroma.user unsubscribe` -> `pleroma.user deactivate` --- docs/administration/CLI_tasks/user.md | 19 +++++++++---------- lib/mix/tasks/pleroma/user.ex | 6 +++--- test/tasks/user_test.exs | 8 ++++---- 3 files changed, 16 insertions(+), 17 deletions(-) diff --git a/docs/administration/CLI_tasks/user.md b/docs/administration/CLI_tasks/user.md index f535dad82..797641898 100644 --- a/docs/administration/CLI_tasks/user.md +++ b/docs/administration/CLI_tasks/user.md @@ -95,33 +95,33 @@ mix pleroma.user sign_out ``` -## Deactivate or activate a user +## Deactivate or activate a user ```sh tab="OTP" - ./bin/pleroma_ctl user toggle_activated + ./bin/pleroma_ctl user toggle_activated ``` ```sh tab="From Source" -mix pleroma.user toggle_activated +mix pleroma.user toggle_activated ``` -## Unsubscribe local users from a user and deactivate the user +## Deactivate a user and unsubscribes local users from the user ```sh tab="OTP" - ./bin/pleroma_ctl user unsubscribe NICKNAME + ./bin/pleroma_ctl user deactivate NICKNAME ``` ```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" - ./bin/pleroma_ctl user unsubscribe_all_from_instance + ./bin/pleroma_ctl user deacitivate_all_from_instance ``` ```sh tab="From Source" -mix pleroma.user unsubscribe_all_from_instance +mix pleroma.user deactivate_all_from_instance ``` @@ -177,4 +177,3 @@ mix pleroma.user untag ```sh tab="From Source" mix pleroma.user toggle_confirmed ``` - diff --git a/lib/mix/tasks/pleroma/user.ex b/lib/mix/tasks/pleroma/user.ex index 93ecb4631..3635c02bc 100644 --- a/lib/mix/tasks/pleroma/user.ex +++ b/lib/mix/tasks/pleroma/user.ex @@ -144,7 +144,7 @@ defmodule Mix.Tasks.Pleroma.User do end end - def run(["unsubscribe", nickname]) do + def run(["deactivate", nickname]) do start_pleroma() with %User{} = user <- User.get_cached_by_nickname(nickname) do @@ -163,7 +163,7 @@ defmodule Mix.Tasks.Pleroma.User do end end - def run(["unsubscribe_all_from_instance", instance]) do + def run(["deactivate_all_from_instance", instance]) do start_pleroma() Pleroma.User.Query.build(%{nickname: "@#{instance}"}) @@ -171,7 +171,7 @@ defmodule Mix.Tasks.Pleroma.User do |> Stream.each(fn users -> users |> Enum.each(fn user -> - run(["unsubscribe", user.nickname]) + run(["deactivate", user.nickname]) end) end) |> Stream.run() diff --git a/test/tasks/user_test.exs b/test/tasks/user_test.exs index 4b3ab5a87..ab7637511 100644 --- a/test/tasks/user_test.exs +++ b/test/tasks/user_test.exs @@ -169,7 +169,7 @@ defmodule Mix.Tasks.Pleroma.UserTest do end end - describe "running unsubscribe" do + describe "running deactivate" do test "user is unsubscribed" do followed = insert(:user) 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, 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 message =~ "Deactivating" @@ -192,8 +192,8 @@ defmodule Mix.Tasks.Pleroma.UserTest do assert user.deactivated end - test "no user to unsubscribe" do - Mix.Tasks.Pleroma.User.run(["unsubscribe", "nonexistent"]) + test "no user to deactivate" do + Mix.Tasks.Pleroma.User.run(["deactivate", "nonexistent"]) assert_received {:mix_shell, :error, [message]} assert message =~ "No user"