summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Felder <feld@feld.me>2024-01-29 17:44:54 -0500
committerMark Felder <feld@feld.me>2024-01-29 18:36:34 -0500
commit378edeaf159c0ff98780ad1b41f513992f1af305 (patch)
tree7fdac91b83cd04d51e8a6fce5e54b7a0636df15c
parent3cb2807244887847f4511d3627d3cdeab6e4876c (diff)
downloadpleroma-378edeaf159c0ff98780ad1b41f513992f1af305.tar.gz
pleroma-378edeaf159c0ff98780ad1b41f513992f1af305.zip
Pleroma.Web.MastodonAPI.DomainBlockController: dialyzer errors
lib/pleroma/web/mastodon_api/controllers/domain_block_controller.ex:32:call The function call will not succeed. Phoenix.Controller.json( _conn :: %{ :assigns => %{:user => _, _ => _}, :body_params => %{:domain => _, _ => _}, _ => _ }, %{} ) breaks the contract (Plug.Conn.t(), term()) :: Plug.Conn.t() ________________________________________________________________________________ lib/pleroma/web/mastodon_api/controllers/domain_block_controller.ex:43:call The function call will not succeed. Phoenix.Controller.json( _conn :: %{ :assigns => %{:user => _, _ => _}, :body_params => %{:domain => _, _ => _}, _ => _ }, %{} ) breaks the contract (Plug.Conn.t(), term()) :: Plug.Conn.t()
-rw-r--r--lib/pleroma/web/api_spec/operations/domain_block_operation.ex4
-rw-r--r--lib/pleroma/web/mastodon_api/controllers/domain_block_controller.ex4
2 files changed, 4 insertions, 4 deletions
diff --git a/lib/pleroma/web/api_spec/operations/domain_block_operation.ex b/lib/pleroma/web/api_spec/operations/domain_block_operation.ex
index 2340fd914..dac3bc883 100644
--- a/lib/pleroma/web/api_spec/operations/domain_block_operation.ex
+++ b/lib/pleroma/web/api_spec/operations/domain_block_operation.ex
@@ -73,10 +73,10 @@ defmodule Pleroma.Web.ApiSpec.DomainBlockOperation do
%Schema{
type: :object,
properties: %{
- domain: %Schema{type: :string}
+ "domain" => %Schema{type: :string}
}
},
- required: false,
+ required: true,
example: %{
"domain" => "facebook.com"
}
diff --git a/lib/pleroma/web/mastodon_api/controllers/domain_block_controller.ex b/lib/pleroma/web/mastodon_api/controllers/domain_block_controller.ex
index b2e347ed9..33dfee3ca 100644
--- a/lib/pleroma/web/mastodon_api/controllers/domain_block_controller.ex
+++ b/lib/pleroma/web/mastodon_api/controllers/domain_block_controller.ex
@@ -27,7 +27,7 @@ defmodule Pleroma.Web.MastodonAPI.DomainBlockController do
end
@doc "POST /api/v1/domain_blocks"
- def create(%{assigns: %{user: blocker}, body_params: %{domain: domain}} = conn, _params) do
+ def create(%{assigns: %{user: blocker}, body_params: %{"domain" => domain}} = conn, _params) do
User.block_domain(blocker, domain)
json(conn, %{})
end
@@ -38,7 +38,7 @@ defmodule Pleroma.Web.MastodonAPI.DomainBlockController do
end
@doc "DELETE /api/v1/domain_blocks"
- def delete(%{assigns: %{user: blocker}, body_params: %{domain: domain}} = conn, _params) do
+ def delete(%{assigns: %{user: blocker}, body_params: %{"domain" => domain}} = conn, _params) do
User.unblock_domain(blocker, domain)
json(conn, %{})
end