X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=lib%2Fpleroma%2Fweb%2Fmastodon_api%2Fcontrollers%2Fdomain_block_controller.ex;h=e4156cbe6f5661f4e665900e8eb44a6a65213eb3;hb=f497cf2f7c21196c4d633ddf0d14f0a4ede00cea;hp=03db6c9b838d82b1569a85bb1e485dc2a027f0e4;hpb=408750b94e1374c815c80a1060892231f40b54fb;p=akkoma
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 03db6c9b8..e4156cbe6 100644
--- a/lib/pleroma/web/mastodon_api/controllers/domain_block_controller.ex
+++ b/lib/pleroma/web/mastodon_api/controllers/domain_block_controller.ex
@@ -1,15 +1,28 @@
# Pleroma: A lightweight social networking server
-# Copyright © 2017-2019 Pleroma Authors
+# Copyright © 2017-2020 Pleroma Authors
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.MastodonAPI.DomainBlockController do
use Pleroma.Web, :controller
+ alias Pleroma.Plugs.OAuthScopesPlug
alias Pleroma.User
+ plug(
+ OAuthScopesPlug,
+ %{scopes: ["follow", "read:blocks"]} when action == :index
+ )
+
+ plug(
+ OAuthScopesPlug,
+ %{scopes: ["follow", "write:blocks"]} when action != :index
+ )
+
+ plug(Pleroma.Plugs.EnsurePublicOrAuthenticatedPlug)
+
@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"