mirror of
https://akkoma.dev/AkkomaGang/akkoma.git
synced 2024-11-30 09:02:28 +00:00
mix: add user tag/untag task
This commit is contained in:
parent
25a659d2dc
commit
93e136d70b
|
@ -52,6 +52,14 @@ defmodule Mix.Tasks.Pleroma.User do
|
||||||
- `--locked`/`--no-locked` - whether the user's account is locked
|
- `--locked`/`--no-locked` - whether the user's account is locked
|
||||||
- `--moderator`/`--no-moderator` - whether the user is a moderator
|
- `--moderator`/`--no-moderator` - whether the user is a moderator
|
||||||
- `--admin`/`--no-admin` - whether the user is an admin
|
- `--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
|
def run(["new", nickname, email | rest]) do
|
||||||
{options, [], []} =
|
{options, [], []} =
|
||||||
|
@ -249,6 +257,32 @@ defmodule Mix.Tasks.Pleroma.User do
|
||||||
end
|
end
|
||||||
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
|
def run(["invite"]) do
|
||||||
Common.start_pleroma()
|
Common.start_pleroma()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue