fix for info after tag/untag user

This commit is contained in:
Alexander Strizhakov 2020-07-09 18:59:48 +03:00
parent c2edfd16e0
commit d5fcec8315
No known key found for this signature in database
GPG key ID: 022896A53AEF1381

View file

@ -15,6 +15,8 @@ defmodule Mix.Tasks.Pleroma.User do
@moduledoc File.read!("docs/administration/CLI_tasks/user.md") @moduledoc File.read!("docs/administration/CLI_tasks/user.md")
def run(["new", nickname, email | rest]) do def run(["new", nickname, email | rest]) do
Application.ensure_all_started(:flake_id)
{options, [], []} = {options, [], []} =
OptionParser.parse( OptionParser.parse(
rest, rest,
@ -97,6 +99,7 @@ def run(["new", nickname, email | rest]) do
def run(["rm", nickname]) do def run(["rm", nickname]) do
start_pleroma() start_pleroma()
Application.ensure_all_started(:flake_id)
with %User{local: true} = user <- User.get_cached_by_nickname(nickname), with %User{local: true} = user <- User.get_cached_by_nickname(nickname),
{:ok, delete_data, _} <- Builder.delete(user, user.ap_id), {:ok, delete_data, _} <- Builder.delete(user, user.ap_id),
@ -232,7 +235,7 @@ def run(["tag", nickname | tags]) do
with %User{} = user <- User.get_cached_by_nickname(nickname) do with %User{} = user <- User.get_cached_by_nickname(nickname) do
user = user |> User.tag(tags) user = user |> User.tag(tags)
shell_info("Tags of #{user.nickname}: #{inspect(tags)}") shell_info("Tags of #{user.nickname}: #{inspect(user.tags)}")
else else
_ -> _ ->
shell_error("Could not change user tags for #{nickname}") shell_error("Could not change user tags for #{nickname}")
@ -245,7 +248,7 @@ def run(["untag", nickname | tags]) do
with %User{} = user <- User.get_cached_by_nickname(nickname) do with %User{} = user <- User.get_cached_by_nickname(nickname) do
user = user |> User.untag(tags) user = user |> User.untag(tags)
shell_info("Tags of #{user.nickname}: #{inspect(tags)}") shell_info("Tags of #{user.nickname}: #{inspect(user.tags)}")
else else
_ -> _ ->
shell_error("Could not change user tags for #{nickname}") shell_error("Could not change user tags for #{nickname}")
@ -328,6 +331,7 @@ def run(["revoke_invite", token]) do
def run(["delete_activities", nickname]) do def run(["delete_activities", nickname]) do
start_pleroma() start_pleroma()
Application.ensure_all_started(:flake_id)
with %User{local: true} = user <- User.get_cached_by_nickname(nickname) do with %User{local: true} = user <- User.get_cached_by_nickname(nickname) do
User.delete_user_activities(user) User.delete_user_activities(user)