Merge branch 'dialyzer-fixes' into 'develop'
Dialyzer and gradient fixes See merge request pleroma/pleroma!4051
This commit is contained in:
commit
0b9990a7e5
0
changelog.d/dialyzer4.skip
Normal file
0
changelog.d/dialyzer4.skip
Normal file
@ -111,7 +111,7 @@ defmodule Mix.Tasks.Pleroma.Emoji do
|
||||
|
||||
{:ok, _} =
|
||||
:zip.unzip(binary_archive,
|
||||
cwd: pack_path,
|
||||
cwd: String.to_charlist(pack_path),
|
||||
file_list: files_to_unzip
|
||||
)
|
||||
|
||||
|
@ -256,7 +256,7 @@ defmodule Pleroma.Config.DeprecationWarnings do
|
||||
move_namespace_and_warn(@mrf_config_map, warning_preface)
|
||||
end
|
||||
|
||||
@spec move_namespace_and_warn([config_map()], String.t()) :: :ok | nil
|
||||
@spec move_namespace_and_warn([config_map()], String.t()) :: :ok | :error
|
||||
def move_namespace_and_warn(config_map, warning_preface) do
|
||||
warning =
|
||||
Enum.reduce(config_map, "", fn
|
||||
@ -279,7 +279,7 @@ defmodule Pleroma.Config.DeprecationWarnings do
|
||||
end
|
||||
end
|
||||
|
||||
@spec check_media_proxy_whitelist_config() :: :ok | nil
|
||||
@spec check_media_proxy_whitelist_config() :: :ok | :error
|
||||
def check_media_proxy_whitelist_config do
|
||||
whitelist = Config.get([:media_proxy, :whitelist])
|
||||
|
||||
@ -340,7 +340,7 @@ defmodule Pleroma.Config.DeprecationWarnings do
|
||||
end
|
||||
end
|
||||
|
||||
@spec check_activity_expiration_config() :: :ok | nil
|
||||
@spec check_activity_expiration_config() :: :ok | :error
|
||||
def check_activity_expiration_config do
|
||||
warning_preface = """
|
||||
!!!DEPRECATION WARNING!!!
|
||||
@ -356,7 +356,7 @@ defmodule Pleroma.Config.DeprecationWarnings do
|
||||
)
|
||||
end
|
||||
|
||||
@spec check_remote_ip_plug_name() :: :ok | nil
|
||||
@spec check_remote_ip_plug_name() :: :ok | :error
|
||||
def check_remote_ip_plug_name do
|
||||
warning_preface = """
|
||||
!!!DEPRECATION WARNING!!!
|
||||
@ -372,7 +372,7 @@ defmodule Pleroma.Config.DeprecationWarnings do
|
||||
)
|
||||
end
|
||||
|
||||
@spec check_uploaders_s3_public_endpoint() :: :ok | nil
|
||||
@spec check_uploaders_s3_public_endpoint() :: :ok | :error
|
||||
def check_uploaders_s3_public_endpoint do
|
||||
s3_config = Pleroma.Config.get([Pleroma.Uploaders.S3])
|
||||
|
||||
@ -393,7 +393,7 @@ defmodule Pleroma.Config.DeprecationWarnings do
|
||||
end
|
||||
end
|
||||
|
||||
@spec check_old_chat_shoutbox() :: :ok | nil
|
||||
@spec check_old_chat_shoutbox() :: :ok | :error
|
||||
def check_old_chat_shoutbox do
|
||||
instance_config = Pleroma.Config.get([:instance])
|
||||
chat_config = Pleroma.Config.get([:chat]) || []
|
||||
|
@ -100,7 +100,7 @@ defmodule Pleroma.Emoji.Pack do
|
||||
{:ok, _emoji_files} =
|
||||
:zip.unzip(
|
||||
to_charlist(file.path),
|
||||
[{:file_list, Enum.map(emojies, & &1[:path])}, {:cwd, tmp_dir}]
|
||||
[{:file_list, Enum.map(emojies, & &1[:path])}, {:cwd, String.to_charlist(tmp_dir)}]
|
||||
)
|
||||
|
||||
{_, updated_pack} =
|
||||
|
@ -216,9 +216,6 @@ defmodule Pleroma.Filter do
|
||||
|
||||
:re ->
|
||||
~r/\b#{phrases}\b/i
|
||||
|
||||
_ ->
|
||||
nil
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -54,12 +54,12 @@ defmodule Pleroma.HTTP.RequestBuilder do
|
||||
@doc """
|
||||
Add optional parameters to the request
|
||||
"""
|
||||
@spec add_param(Request.t(), atom(), atom(), any()) :: Request.t()
|
||||
@spec add_param(Request.t(), atom(), atom() | String.t(), any()) :: Request.t()
|
||||
def add_param(request, :query, :query, values), do: %{request | query: values}
|
||||
|
||||
def add_param(request, :body, :body, value), do: %{request | body: value}
|
||||
|
||||
def add_param(request, :body, key, value) do
|
||||
def add_param(request, :body, key, value) when is_binary(key) do
|
||||
request
|
||||
|> Map.put(:body, Multipart.new())
|
||||
|> Map.update!(
|
||||
|
@ -77,7 +77,7 @@ defmodule Pleroma.MFA do
|
||||
{:ok, codes}
|
||||
else
|
||||
{:error, msg} ->
|
||||
%{error: msg}
|
||||
{:error, msg}
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -14,6 +14,7 @@ defmodule Pleroma.MFA.TOTP do
|
||||
@doc """
|
||||
https://github.com/google/google-authenticator/wiki/Key-Uri-Format
|
||||
"""
|
||||
@spec provisioning_uri(String.t(), String.t(), list()) :: String.t()
|
||||
def provisioning_uri(secret, label, opts \\ []) do
|
||||
query =
|
||||
%{
|
||||
@ -27,7 +28,7 @@ defmodule Pleroma.MFA.TOTP do
|
||||
|> URI.encode_query()
|
||||
|
||||
%URI{scheme: "otpauth", host: "totp", path: "/" <> label, query: query}
|
||||
|> URI.to_string()
|
||||
|> to_string()
|
||||
end
|
||||
|
||||
defp default_period, do: Config.get(@config_ns ++ [:period])
|
||||
|
@ -61,15 +61,16 @@ defmodule Pleroma.Pagination do
|
||||
|> Repo.all()
|
||||
end
|
||||
|
||||
@spec paginate(Ecto.Query.t(), map(), type(), atom() | nil) :: [Ecto.Schema.t()]
|
||||
def paginate(query, options, method \\ :keyset, table_binding \\ nil)
|
||||
|
||||
def paginate(list, options, _method, _table_binding) when is_list(list) do
|
||||
@spec paginate_list(list(), keyword()) :: list()
|
||||
def paginate_list(list, options) do
|
||||
offset = options[:offset] || 0
|
||||
limit = options[:limit] || 0
|
||||
Enum.slice(list, offset, limit)
|
||||
end
|
||||
|
||||
@spec paginate(Ecto.Query.t(), map(), type(), atom() | nil) :: [Ecto.Schema.t()]
|
||||
def paginate(query, options, method \\ :keyset, table_binding \\ nil)
|
||||
|
||||
def paginate(query, options, :keyset, table_binding) do
|
||||
query
|
||||
|> restrict(:min_id, options, table_binding)
|
||||
|
@ -20,7 +20,7 @@ defmodule Pleroma.Web.ControllerHelper do
|
||||
|> json(json)
|
||||
end
|
||||
|
||||
@spec fetch_integer_param(map(), String.t(), integer() | nil) :: integer() | nil
|
||||
@spec fetch_integer_param(map(), String.t() | atom(), integer() | nil) :: integer() | nil
|
||||
def fetch_integer_param(params, name, default \\ nil) do
|
||||
params
|
||||
|> Map.get(name, default)
|
||||
|
@ -11,8 +11,6 @@ defmodule Pleroma.Web.EmbedController do
|
||||
|
||||
alias Pleroma.Web.ActivityPub.Visibility
|
||||
|
||||
plug(:put_layout, :embed)
|
||||
|
||||
def show(conn, %{"id" => id}) do
|
||||
with %Activity{local: true} = activity <-
|
||||
Activity.get_by_id_with_object(id),
|
||||
|
@ -156,7 +156,7 @@ defmodule Pleroma.Web.MastodonAPI.SearchController do
|
||||
tags
|
||||
end
|
||||
|
||||
Pleroma.Pagination.paginate(tags, options)
|
||||
Pleroma.Pagination.paginate_list(tags, options)
|
||||
end
|
||||
|
||||
defp add_joined_tag(tags) do
|
||||
|
@ -610,13 +610,8 @@ defmodule Pleroma.Web.OAuth.OAuthController do
|
||||
end
|
||||
end
|
||||
|
||||
@spec validate_scopes(App.t(), map() | list()) ::
|
||||
@spec validate_scopes(App.t(), list()) ::
|
||||
{:ok, list()} | {:error, :missing_scopes | :unsupported_scopes}
|
||||
defp validate_scopes(%App{} = app, params) when is_map(params) do
|
||||
requested_scopes = Scopes.fetch_scopes(params, app.scopes)
|
||||
validate_scopes(app, requested_scopes)
|
||||
end
|
||||
|
||||
defp validate_scopes(%App{} = app, requested_scopes) when is_list(requested_scopes) do
|
||||
Scopes.validate(requested_scopes, app.scopes)
|
||||
end
|
||||
|
@ -112,7 +112,6 @@ defmodule Pleroma.Web.OStatus.OStatusController do
|
||||
%{data: %{"attachment" => [%{"url" => [url | _]} | _]}} <- object,
|
||||
true <- String.starts_with?(url["mediaType"], ["audio", "video"]) do
|
||||
conn
|
||||
|> put_layout(:metadata_player)
|
||||
|> put_resp_header("x-frame-options", "ALLOW")
|
||||
|> put_resp_header(
|
||||
"content-security-policy",
|
||||
|
@ -28,7 +28,7 @@ defmodule Pleroma.Web.PleromaAPI.MascotController do
|
||||
_
|
||||
) do
|
||||
with {:content_type, "image" <> _} <- {:content_type, file.content_type},
|
||||
{:ok, object} <- ActivityPub.upload(file, actor: User.ap_id(user)) do
|
||||
{_, {:ok, object}} <- {:upload, ActivityPub.upload(file, actor: User.ap_id(user))} do
|
||||
attachment = render_attachment(object)
|
||||
{:ok, _user} = User.mascot_update(user, attachment)
|
||||
|
||||
|
@ -14,7 +14,7 @@ defmodule Pleroma.Web.Plugs.RateLimiter.Supervisor do
|
||||
Pleroma.Web.Plugs.RateLimiter.LimiterSupervisor
|
||||
]
|
||||
|
||||
opts = [strategy: :one_for_one, name: Pleroma.Web.Streamer.Supervisor]
|
||||
opts = [strategy: :one_for_one]
|
||||
Supervisor.init(children, opts)
|
||||
end
|
||||
end
|
||||
|
@ -13,7 +13,6 @@ defmodule Pleroma.Web.StaticFE.StaticFEController do
|
||||
alias Pleroma.Web.Metadata
|
||||
alias Pleroma.Web.Router.Helpers
|
||||
|
||||
plug(:put_layout, :static_fe)
|
||||
plug(:assign_id)
|
||||
|
||||
@page_keys ["max_id", "min_id", "limit", "since_id", "order"]
|
||||
|
Loading…
Reference in New Issue
Block a user