AccountController: Return scope in proper format.
authorlain <lain@soykaf.club>
Fri, 26 Jun 2020 14:15:27 +0000 (16:15 +0200)
committerlain <lain@soykaf.club>
Fri, 26 Jun 2020 14:15:27 +0000 (16:15 +0200)
lib/pleroma/web/api_spec/operations/account_operation.ex
lib/pleroma/web/mastodon_api/controllers/account_controller.ex
test/web/mastodon_api/controllers/account_controller_test.exs

index 9bde8fc0dec593c45b676a0588e49afd074ce378..d94dae374020d8f2d86c12e4eb7ae34de363b7de 100644 (file)
@@ -446,13 +446,13 @@ defmodule Pleroma.Web.ApiSpec.AccountOperation do
       properties: %{
         token_type: %Schema{type: :string},
         access_token: %Schema{type: :string},
-        scope: %Schema{type: :array, items: %Schema{type: :string}},
+        scope: %Schema{type: :string},
         created_at: %Schema{type: :integer, format: :"date-time"}
       },
       example: %{
         "access_token" => "i9hAVVzGld86Pl5JtLtizKoXVvtTlSCJvwaugCxvZzk",
         "created_at" => 1_585_918_714,
-        "scope" => ["read", "write", "follow", "push"],
+        "scope" => "read write follow push",
         "token_type" => "Bearer"
       }
     }
index 7a88a847c412f2818eddb863f54df41ac95980b1..a87dddddf3d783115ec21dd158afcae79c051772 100644 (file)
@@ -104,7 +104,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountController do
       json(conn, %{
         token_type: "Bearer",
         access_token: token.token,
-        scope: app.scopes,
+        scope: app.scopes |> Enum.join(" "),
         created_at: Token.Utils.format_created_at(token)
       })
     else
index ebfcedd0196dcb7feb139fa8d4e8e712576c8fb5..fcc1e792bb115aa295cc5ce740f902584f196e61 100644 (file)
@@ -905,7 +905,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountControllerTest do
       %{
         "access_token" => token,
         "created_at" => _created_at,
-        "scope" => _scope,
+        "scope" => ^scope,
         "token_type" => "Bearer"
       } = json_response_and_validate_schema(conn, 200)
 
@@ -1067,7 +1067,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountControllerTest do
       assert %{
                "access_token" => access_token,
                "created_at" => _,
-               "scope" => ["read", "write", "follow", "push"],
+               "scope" => "read write follow push",
                "token_type" => "Bearer"
              } = response
 
@@ -1185,7 +1185,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountControllerTest do
       assert %{
                "access_token" => access_token,
                "created_at" => _,
-               "scope" => ["read"],
+               "scope" => "read",
                "token_type" => "Bearer"
              } =
                conn