diff options
author | lambda <pleromagit@rogerbraun.net> | 2018-12-10 18:33:36 +0000 |
---|---|---|
committer | lambda <pleromagit@rogerbraun.net> | 2018-12-10 18:33:36 +0000 |
commit | bda25b999b5176c73380bff9a1ce6be51cba4820 (patch) | |
tree | b37c841539f8544848fee2124572a0abe9a47953 /lib/mix | |
parent | 993c8c8bd4e94985c647f4f9e927cbaa7148e6a0 (diff) | |
parent | ab98c92d86f91b0c83f482e002e4a518b93f65ca (diff) | |
download | pleroma-bda25b999b5176c73380bff9a1ce6be51cba4820.tar.gz |
Merge branch 'develop' into 'fix/mix-task-uploads-moduledoc'
# Conflicts:
# lib/mix/tasks/pleroma/uploads.ex
Diffstat (limited to 'lib/mix')
-rw-r--r-- | lib/mix/tasks/pleroma/common.ex | 2 | ||||
-rw-r--r-- | lib/mix/tasks/pleroma/instance.ex | 1 | ||||
-rw-r--r-- | lib/mix/tasks/pleroma/relay.ex | 4 | ||||
-rw-r--r-- | lib/mix/tasks/pleroma/uploads.ex | 9 | ||||
-rw-r--r-- | lib/mix/tasks/pleroma/user.ex | 44 |
5 files changed, 30 insertions, 30 deletions
diff --git a/lib/mix/tasks/pleroma/common.ex b/lib/mix/tasks/pleroma/common.ex index 06893af05..36432c291 100644 --- a/lib/mix/tasks/pleroma/common.ex +++ b/lib/mix/tasks/pleroma/common.ex @@ -1,5 +1,5 @@ defmodule Mix.Tasks.Pleroma.Common do - @shortdoc "Common functions to be reused in mix tasks" + @doc "Common functions to be reused in mix tasks" def start_pleroma do Mix.Task.run("app.start") end diff --git a/lib/mix/tasks/pleroma/instance.ex b/lib/mix/tasks/pleroma/instance.ex index c66322707..3be856115 100644 --- a/lib/mix/tasks/pleroma/instance.ex +++ b/lib/mix/tasks/pleroma/instance.ex @@ -1,6 +1,5 @@ defmodule Mix.Tasks.Pleroma.Instance do use Mix.Task - alias Pleroma.{Repo, User} alias Mix.Tasks.Pleroma.Common @shortdoc "Manages Pleroma instance" diff --git a/lib/mix/tasks/pleroma/relay.ex b/lib/mix/tasks/pleroma/relay.ex index f4b7ff6a0..03586d6c3 100644 --- a/lib/mix/tasks/pleroma/relay.ex +++ b/lib/mix/tasks/pleroma/relay.ex @@ -22,7 +22,7 @@ defmodule Mix.Tasks.Pleroma.Relay do def run(["follow", target]) do Common.start_pleroma() - with {:ok, activity} <- Relay.follow(target) do + with {:ok, _activity} <- Relay.follow(target) do # put this task to sleep to allow the genserver to push out the messages :timer.sleep(500) else @@ -33,7 +33,7 @@ defmodule Mix.Tasks.Pleroma.Relay do def run(["unfollow", target]) do Common.start_pleroma() - with {:ok, activity} <- Relay.unfollow(target) do + with {:ok, _activity} <- Relay.unfollow(target) do # put this task to sleep to allow the genserver to push out the messages :timer.sleep(500) else diff --git a/lib/mix/tasks/pleroma/uploads.ex b/lib/mix/tasks/pleroma/uploads.ex index 6ffc941c9..63299b2ae 100644 --- a/lib/mix/tasks/pleroma/uploads.ex +++ b/lib/mix/tasks/pleroma/uploads.ex @@ -1,13 +1,15 @@ defmodule Mix.Tasks.Pleroma.Uploads do use Mix.Task - import Mix.Ecto - alias Pleroma.{Upload, Uploaders.Local, Uploaders.S3} + alias Pleroma.{Upload, Uploaders.Local} alias Mix.Tasks.Pleroma.Common require Logger @log_every 50 + @shortdoc "Migrates uploads from local to remote storage" @moduledoc """ + Manages uploads + ## Migrate uploads from local to remote storage mix pleroma.uploads migrate_local TARGET_UPLOADER [OPTIONS...] Options: @@ -16,7 +18,6 @@ defmodule Mix.Tasks.Pleroma.Uploads do A list of avalible uploaders can be seen in config.exs """ - def run(["migrate_local", target_uploader | args]) do delete? = Enum.member?(args, "--delete") Common.start_pleroma() @@ -63,7 +64,7 @@ defmodule Mix.Tasks.Pleroma.Uploads do File.exists?(root_path) -> file = Path.basename(id) - [hash, ext] = String.split(id, ".") + hash = Path.rootname(id) {%Pleroma.Upload{id: hash, name: file, path: file, tempfile: root_path}, root_path} true -> diff --git a/lib/mix/tasks/pleroma/user.ex b/lib/mix/tasks/pleroma/user.ex index 590553443..2675b021d 100644 --- a/lib/mix/tasks/pleroma/user.ex +++ b/lib/mix/tasks/pleroma/user.ex @@ -20,7 +20,7 @@ defmodule Mix.Tasks.Pleroma.User do - `--admin`/`--no-admin` - whether the user is an admin ## Generate an invite link. - + mix pleroma.user invite ## Delete the user's account. @@ -32,7 +32,7 @@ defmodule Mix.Tasks.Pleroma.User do mix pleroma.user toggle_activated NICKNAME ## Unsubscribe local users from user's account and deactivate it - + mix pleroma.user unsubscribe NICKNAME ## Create a password reset link. @@ -235,6 +235,26 @@ defmodule Mix.Tasks.Pleroma.User do end end + def run(["invite"]) do + Common.start_pleroma() + + with {:ok, token} <- Pleroma.UserInviteToken.create_token() do + Mix.shell().info("Generated user invite token") + + url = + Pleroma.Web.Router.Helpers.redirect_url( + Pleroma.Web.Endpoint, + :registration_page, + token.token + ) + + IO.puts(url) + else + _ -> + Mix.shell().error("Could not create invite token.") + end + end + defp set_moderator(user, value) do info_cng = User.Info.admin_api_update(user.info, %{is_moderator: value}) @@ -270,24 +290,4 @@ defmodule Mix.Tasks.Pleroma.User do Mix.shell().info("Locked status of #{user.nickname}: #{user.info.locked}") end - - def run(["invite"]) do - Common.start_pleroma() - - with {:ok, token} <- Pleroma.UserInviteToken.create_token() do - Mix.shell().info("Generated user invite token") - - url = - Pleroma.Web.Router.Helpers.redirect_url( - Pleroma.Web.Endpoint, - :registration_page, - token.token - ) - - IO.puts(url) - else - _ -> - Mix.shell().error("Could not create invite token.") - end - end end |