fix compile warnings
This commit is contained in:
parent
cf85a9aea1
commit
074fa790ba
53 changed files with 203 additions and 259 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -1,18 +1,16 @@
|
|||
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 "Migrate uploads from local to remote storage"
|
||||
@longdoc """
|
||||
@doc """
|
||||
Manages uploads
|
||||
## Migrate uploads from local to remote storage
|
||||
|
||||
"""
|
||||
|
||||
def run(["migrate_local", target_uploader | args]) do
|
||||
delete? = Enum.member?(args, "--delete")
|
||||
Common.start_pleroma()
|
||||
|
|
@ -59,7 +57,7 @@ defmodule Mix.Tasks.Pleroma.Uploads do
|
|||
|
||||
File.exists?(root_path) ->
|
||||
file = Path.basename(id)
|
||||
[hash, ext] = String.split(id, ".")
|
||||
[hash, _ext] = String.split(id, ".")
|
||||
{%Pleroma.Upload{id: hash, name: file, path: file, tempfile: root_path}, root_path}
|
||||
|
||||
true ->
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue