mirror of
https://git.pleroma.social/pleroma/pleroma.git
synced 2024-12-23 16:40:29 +00:00
Add specs for AccountController.block and AccountController.unblock
This commit is contained in:
parent
e4195d4a68
commit
68a979b824
3 changed files with 34 additions and 3 deletions
|
@ -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
|
||||
|
|
|
@ -96,7 +96,9 @@ defmodule Pleroma.Web.MastodonAPI.AccountController do
|
|||
:follow,
|
||||
:unfollow,
|
||||
:mute,
|
||||
:unmute
|
||||
:unmute,
|
||||
:block,
|
||||
:unblock
|
||||
]
|
||||
)
|
||||
|
||||
|
|
|
@ -819,10 +819,12 @@ defmodule Pleroma.Web.MastodonAPI.AccountControllerTest do
|
|||
ret_conn = post(conn, "/api/v1/accounts/#{other_user.id}/block")
|
||||
|
||||
assert %{"id" => _id, "blocking" => true} = json_response(ret_conn, 200)
|
||||
assert_schema(json_response(ret_conn, 200), "AccountRelationship", ApiSpec.spec())
|
||||
|
||||
conn = post(conn, "/api/v1/accounts/#{other_user.id}/unblock")
|
||||
|
||||
assert %{"id" => _id, "blocking" => false} = json_response(conn, 200)
|
||||
assert_schema(json_response(ret_conn, 200), "AccountRelationship", ApiSpec.spec())
|
||||
end
|
||||
|
||||
describe "create account by app" do
|
||||
|
|
Loading…
Reference in a new issue