projects
/
akkoma
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'issue/1855' into 'develop'
[akkoma]
/
lib
/
pleroma
/
web
/
mastodon_api
/
controllers
/
domain_block_controller.ex
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 45c5ef8a44a70047e712adefbb0a2d3c66eb665e..825b231ab3b02526041c11af5eece7cbe09cebd5 100644
(file)
--- a/
lib/pleroma/web/mastodon_api/controllers/domain_block_controller.ex
+++ b/
lib/pleroma/web/mastodon_api/controllers/domain_block_controller.ex
@@
-1,5
+1,5
@@
# Pleroma: A lightweight social networking server
# Pleroma: A lightweight social networking server
-# Copyright © 2017-20
19
Pleroma Authors <https://pleroma.social/>
+# Copyright © 2017-20
20
Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.MastodonAPI.DomainBlockController do
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.MastodonAPI.DomainBlockController do
@@
-8,6
+8,9
@@
defmodule Pleroma.Web.MastodonAPI.DomainBlockController do
alias Pleroma.Plugs.OAuthScopesPlug
alias Pleroma.User
alias Pleroma.Plugs.OAuthScopesPlug
alias Pleroma.User
+ plug(Pleroma.Web.ApiSpec.CastAndValidate)
+ defdelegate open_api_operation(action), to: Pleroma.Web.ApiSpec.DomainBlockOperation
+
plug(
OAuthScopesPlug,
%{scopes: ["follow", "read:blocks"]} when action == :index
plug(
OAuthScopesPlug,
%{scopes: ["follow", "read:blocks"]} when action == :index
@@
-19,18
+22,18
@@
defmodule Pleroma.Web.MastodonAPI.DomainBlockController do
)
@doc "GET /api/v1/domain_blocks"
)
@doc "GET /api/v1/domain_blocks"
- def index(%{assigns: %{user:
%{info: info}
}} = conn, _) do
- json(conn, Map.get(
info
, :domain_blocks, []))
+ def index(%{assigns: %{user:
user
}} = conn, _) do
+ json(conn, Map.get(
user
, :domain_blocks, []))
end
@doc "POST /api/v1/domain_blocks"
end
@doc "POST /api/v1/domain_blocks"
- def create(%{assigns: %{user: blocker}
} = conn, %{"domain" => domain}
) do
+ def create(%{assigns: %{user: blocker}
, body_params: %{domain: domain}} = conn, _params
) do
User.block_domain(blocker, domain)
json(conn, %{})
end
@doc "DELETE /api/v1/domain_blocks"
User.block_domain(blocker, domain)
json(conn, %{})
end
@doc "DELETE /api/v1/domain_blocks"
- def delete(%{assigns: %{user: blocker}
} = conn, %{"domain" => domain}
) do
+ def delete(%{assigns: %{user: blocker}
, body_params: %{domain: domain}} = conn, _params
) do
User.unblock_domain(blocker, domain)
json(conn, %{})
end
User.unblock_domain(blocker, domain)
json(conn, %{})
end