diff options
author | Haelwenn (lanodan) Monnier <contact@hacktivis.me> | 2020-09-01 12:48:39 +0200 |
---|---|---|
committer | Haelwenn (lanodan) Monnier <contact@hacktivis.me> | 2020-09-01 12:49:32 +0200 |
commit | d8728580468ecf876e531440fa31aef6a3e33f7b (patch) | |
tree | 10993f7e27d3188559ae95d4fd6d9437529ce3b7 /lib/pleroma/web/api_spec | |
parent | d48755791ddfea0b30bc5a843dfc4181efd63982 (diff) | |
download | pleroma-d8728580468ecf876e531440fa31aef6a3e33f7b.tar.gz |
Fix removing an account from a list
Mastodon (Frontend) changed a different method for deletes,
keeping old format as mastodon documentation is too loose
Diffstat (limited to 'lib/pleroma/web/api_spec')
-rw-r--r-- | lib/pleroma/web/api_spec/operations/list_operation.ex | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/lib/pleroma/web/api_spec/operations/list_operation.ex b/lib/pleroma/web/api_spec/operations/list_operation.ex index c88ed5dd0..15039052e 100644 --- a/lib/pleroma/web/api_spec/operations/list_operation.ex +++ b/lib/pleroma/web/api_spec/operations/list_operation.ex @@ -114,7 +114,7 @@ defmodule Pleroma.Web.ApiSpec.ListOperation do description: "Add accounts to the given list.", operationId: "ListController.add_to_list", parameters: [id_param()], - requestBody: add_remove_accounts_request(), + requestBody: add_remove_accounts_request(true), security: [%{"oAuth" => ["write:lists"]}], responses: %{ 200 => Operation.response("Empty object", "application/json", %Schema{type: :object}) @@ -127,8 +127,16 @@ defmodule Pleroma.Web.ApiSpec.ListOperation do tags: ["Lists"], summary: "Remove accounts from list", operationId: "ListController.remove_from_list", - parameters: [id_param()], - requestBody: add_remove_accounts_request(), + parameters: [ + id_param(), + Operation.parameter( + :account_ids, + :query, + %Schema{type: :array, items: %Schema{type: :string}}, + "Array of account IDs" + ) + ], + requestBody: add_remove_accounts_request(false), security: [%{"oAuth" => ["write:lists"]}], responses: %{ 200 => Operation.response("Empty object", "application/json", %Schema{type: :object}) @@ -171,7 +179,7 @@ defmodule Pleroma.Web.ApiSpec.ListOperation do ) end - defp add_remove_accounts_request do + defp add_remove_accounts_request(required) when is_boolean(required) do request_body( "Parameters", %Schema{ @@ -180,9 +188,9 @@ defmodule Pleroma.Web.ApiSpec.ListOperation do properties: %{ account_ids: %Schema{type: :array, description: "Array of account IDs", items: FlakeID} }, - required: [:account_ids] + required: required && [:account_ids] }, - required: true + required: required ) end end |