Pleroma.Web.MastodonAPI.AccountController: dialyzer errors
lib/pleroma/web/mastodon_api/controllers/account_controller.ex:479:call The function call will not succeed. Phoenix.Controller.render( _conn :: %{ :assigns => %{:account => _, :user => _, _ => _}, :body_params => %{:comment => _, _ => _}, _ => _ }, <<114, 101, 108, 97, 116, 105, 111, 110, 115, 104, 105, 112, 46, 106, 115, 111, 110>>, [ {:target, %Pleroma.User{:id => _, _ => _}} | {:user, %Pleroma.User{:id => _, _ => _}}, ... ] ) will never return since the success typing is: ( %Plug.Conn{ :adapter => {atom(), _}, :assigns => %{atom() => _}, :body_params => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _}, :cookies => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _}, :halted => boolean(), :host => binary(), :method => binary(), :owner => pid(), :params => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _}, :path_info => [binary()], :path_params => %{binary() => binary() | [any()] | map()}, :port => char(), :private => %{atom() => _}, :query_params => %Plug.Conn.Unfetched{ :aspect => atom(), binary() => binary() | [any()] | map() }, :query_string => binary(), :remote_ip => {byte(), byte(), byte(), byte()} | {char(), char(), char(), char(), char(), char(), char(), char()}, :req_cookies => %Plug.Conn.Unfetched{:aspect => atom(), binary() => binary()}, :req_headers => [{_, _}], :request_path => binary(), :resp_body => nil | binary() | maybe_improper_list( binary() | maybe_improper_list(any(), binary() | []) | byte(), binary() | [] ), :resp_cookies => %{binary() => map()}, :resp_headers => [{_, _}], :scheme => :http | :https, :script_name => [binary()], :secret_key_base => nil | binary(), :state => :chunked | :file | :sent | :set | :set_chunked | :set_file | :unset | :upgraded, :status => nil | non_neg_integer() }, atom() | binary(), atom() | binary() | [{_, _}] | map() ) :: %Plug.Conn{ :adapter => {atom(), _}, :assigns => %{atom() => _}, :body_params => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _}, :cookies => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _}, :halted => boolean(), :host => binary(), :method => binary(), :owner => pid(), :params => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _}, :path_info => [binary()], :path_params => %{binary() => binary() | [any()] | map()}, :port => char(), :private => %{atom() => _}, :query_params => %Plug.Conn.Unfetched{ :aspect => atom(), binary() => binary() | [any()] | map() }, :query_string => binary(), :remote_ip => {byte(), byte(), byte(), byte()} | {char(), char(), char(), char(), char(), char(), char(), char()}, :req_cookies => %Plug.Conn.Unfetched{:aspect => atom(), binary() => binary()}, :req_headers => [{_, _}], :request_path => binary(), :resp_body => nil | binary() | maybe_improper_list( binary() | maybe_improper_list(any(), binary() | []) | byte(), binary() | [] ), :resp_cookies => %{binary() => map()}, :resp_headers => [{_, _}], :scheme => :http | :https, :script_name => [binary()], :secret_key_base => nil | binary(), :state => :sent, :status => nil | non_neg_integer() } and the contract is (Plug.Conn.t(), binary() | atom(), Keyword.t() | map()) :: Plug.Conn.t() ________________________________________________________________________________ lib/pleroma/web/mastodon_api/controllers/account_controller.ex:519:call The function call will not succeed. Plug.Conn.assign( _conn :: %{:body_params => %{:uri => _, _ => _}, _ => _}, :account, _user :: %Pleroma.User{_ => _} ) breaks the contract (t(), atom(), term()) :: t()
This commit is contained in:
parent
e2fc03ec72
commit
e53c20b03c
@ -882,9 +882,9 @@ defmodule Pleroma.Web.ApiSpec.AccountOperation do
|
|||||||
description: "POST body for muting an account",
|
description: "POST body for muting an account",
|
||||||
type: :object,
|
type: :object,
|
||||||
properties: %{
|
properties: %{
|
||||||
uri: %Schema{type: :string, nullable: true, format: :uri}
|
"uri" => %Schema{type: :string, nullable: true, format: :uri}
|
||||||
},
|
},
|
||||||
required: [:uri]
|
required: ["uri"]
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -925,7 +925,7 @@ defmodule Pleroma.Web.ApiSpec.AccountOperation do
|
|||||||
description: "POST body for adding a note for an account",
|
description: "POST body for adding a note for an account",
|
||||||
type: :object,
|
type: :object,
|
||||||
properties: %{
|
properties: %{
|
||||||
comment: %Schema{
|
"comment" => %Schema{
|
||||||
type: :string,
|
type: :string,
|
||||||
description: "Account note body"
|
description: "Account note body"
|
||||||
}
|
}
|
||||||
|
@ -472,7 +472,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountController do
|
|||||||
|
|
||||||
@doc "POST /api/v1/accounts/:id/note"
|
@doc "POST /api/v1/accounts/:id/note"
|
||||||
def note(
|
def note(
|
||||||
%{assigns: %{user: noter, account: target}, body_params: %{comment: comment}} = conn,
|
%{assigns: %{user: noter, account: target}, body_params: %{"comment" => comment}} = conn,
|
||||||
_params
|
_params
|
||||||
) do
|
) do
|
||||||
with {:ok, _user_note} <- UserNote.create(noter, target, comment) do
|
with {:ok, _user_note} <- UserNote.create(noter, target, comment) do
|
||||||
@ -513,7 +513,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountController do
|
|||||||
end
|
end
|
||||||
|
|
||||||
@doc "POST /api/v1/follows"
|
@doc "POST /api/v1/follows"
|
||||||
def follow_by_uri(%{body_params: %{uri: uri}} = conn, _) do
|
def follow_by_uri(%{body_params: %{"uri" => uri}} = conn, _) do
|
||||||
case User.get_cached_by_nickname(uri) do
|
case User.get_cached_by_nickname(uri) do
|
||||||
%User{} = user ->
|
%User{} = user ->
|
||||||
conn
|
conn
|
||||||
|
Loading…
Reference in New Issue
Block a user