diff options
| author | Egor Kislitsyn <egor@kislitsyn.com> | 2019-02-06 11:33:00 +0700 | 
|---|---|---|
| committer | Egor Kislitsyn <egor@kislitsyn.com> | 2019-02-06 11:33:00 +0700 | 
| commit | 6f05f448f86a0fdaf3bd04e626f6c311692edbef (patch) | |
| tree | e309bb2d6f493f135f9e5fab7411aba0f39b1096 /lib/mix/tasks | |
| parent | 14d967f515c4a431b8059a19d4b84a83c0f2aa28 (diff) | |
| parent | c46490b1999dd0ddb3d3b23409ba725c21811a96 (diff) | |
| download | pleroma-6f05f448f86a0fdaf3bd04e626f6c311692edbef.tar.gz pleroma-6f05f448f86a0fdaf3bd04e626f6c311692edbef.zip  | |
Merge branch 'develop' of git.pleroma.social:pleroma/pleroma into feature/jobs
Diffstat (limited to 'lib/mix/tasks')
| -rw-r--r-- | lib/mix/tasks/pleroma/user.ex | 34 | 
1 files changed, 34 insertions, 0 deletions
diff --git a/lib/mix/tasks/pleroma/user.ex b/lib/mix/tasks/pleroma/user.ex index c311d48e0..ffc45fd03 100644 --- a/lib/mix/tasks/pleroma/user.ex +++ b/lib/mix/tasks/pleroma/user.ex @@ -52,6 +52,14 @@ defmodule Mix.Tasks.Pleroma.User do    - `--locked`/`--no-locked` - whether the user's account is locked    - `--moderator`/`--no-moderator` - whether the user is a moderator    - `--admin`/`--no-admin` - whether the user is an admin + +  ## Add tags to a user. + +      mix pleroma.user tag NICKNAME TAGS + +  ## Delete tags from a user. + +      mix pleroma.user untag NICKNAME TAGS    """    def run(["new", nickname, email | rest]) do      {options, [], []} = @@ -249,6 +257,32 @@ defmodule Mix.Tasks.Pleroma.User do      end    end +  def run(["tag", nickname | tags]) do +    Common.start_pleroma() + +    with %User{} = user <- User.get_by_nickname(nickname) do +      user = user |> User.tag(tags) + +      Mix.shell().info("Tags of #{user.nickname}: #{inspect(tags)}") +    else +      _ -> +        Mix.shell().error("Could not change user tags for #{nickname}") +    end +  end + +  def run(["untag", nickname | tags]) do +    Common.start_pleroma() + +    with %User{} = user <- User.get_by_nickname(nickname) do +      user = user |> User.untag(tags) + +      Mix.shell().info("Tags of #{user.nickname}: #{inspect(tags)}") +    else +      _ -> +        Mix.shell().error("Could not change user tags for #{nickname}") +    end +  end +    def run(["invite"]) do      Common.start_pleroma()  | 
