aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorEgor Kislitsyn <egor@kislitsyn.com>2020-04-09 18:41:18 +0400
committerEgor Kislitsyn <egor@kislitsyn.com>2020-04-13 18:17:08 +0400
commit68a979b8243b9a5b685df2c13388a93b9ede1900 (patch)
tree48dc3a91fd7f2b9724edf93c4c0257f90fe3d81a /lib
parente4195d4a684908d58482f9c865375a080e7b78bc (diff)
downloadpleroma-68a979b8243b9a5b685df2c13388a93b9ede1900.tar.gz
Add specs for AccountController.block and AccountController.unblock
Diffstat (limited to 'lib')
-rw-r--r--lib/pleroma/web/api_spec/operations/account_operation.ex31
-rw-r--r--lib/pleroma/web/mastodon_api/controllers/account_controller.ex4
2 files changed, 32 insertions, 3 deletions
diff --git a/lib/pleroma/web/api_spec/operations/account_operation.ex b/lib/pleroma/web/api_spec/operations/account_operation.ex
index 62ae2eead..73fbe8785 100644
--- a/lib/pleroma/web/api_spec/operations/account_operation.ex
+++ b/lib/pleroma/web/api_spec/operations/account_operation.ex
@@ -278,8 +278,35 @@ defmodule Pleroma.Web.ApiSpec.AccountOperation do
}
end
- def block_operation, do: :ok
- def unblock_operation, do: :ok
+ def block_operation do
+ %Operation{
+ tags: ["accounts"],
+ summary: "Block",
+ operationId: "AccountController.block",
+ security: [%{"oAuth" => ["follow", "write:blocks"]}],
+ description:
+ "Block the given account. Clients should filter statuses from this account if received (e.g. due to a boost in the Home timeline)",
+ parameters: [%Reference{"$ref": "#/components/parameters/accountIdOrNickname"}],
+ responses: %{
+ 200 => Operation.response("Relationship", "application/json", AccountRelationship)
+ }
+ }
+ end
+
+ def unblock_operation do
+ %Operation{
+ tags: ["accounts"],
+ summary: "Unblock",
+ operationId: "AccountController.unblock",
+ security: [%{"oAuth" => ["follow", "write:blocks"]}],
+ description: "Unblock the given account.",
+ parameters: [%Reference{"$ref": "#/components/parameters/accountIdOrNickname"}],
+ responses: %{
+ 200 => Operation.response("Relationship", "application/json", AccountRelationship)
+ }
+ }
+ end
+
def follows_operation, do: :ok
def mutes_operation, do: :ok
def blocks_operation, do: :ok
diff --git a/lib/pleroma/web/mastodon_api/controllers/account_controller.ex b/lib/pleroma/web/mastodon_api/controllers/account_controller.ex
index 9aba2e094..c1f70f32c 100644
--- a/lib/pleroma/web/mastodon_api/controllers/account_controller.ex
+++ b/lib/pleroma/web/mastodon_api/controllers/account_controller.ex
@@ -96,7 +96,9 @@ defmodule Pleroma.Web.MastodonAPI.AccountController do
:follow,
:unfollow,
:mute,
- :unmute
+ :unmute,
+ :block,
+ :unblock
]
)