diff --git a/.sobelow-skips b/.sobelow-skips index 840e346bb..9604b0817 100644 --- a/.sobelow-skips +++ b/.sobelow-skips @@ -40,4 +40,5 @@ FE1EEB91EA633570F703B251AE2D4D4E 7EEC79571F3F7CEEB04A8B86D908382A E7967805C1EA5301F2722C7BDB2F25F3 BDFB0FB1AAF69C18212CBCFD42F8B717 -40220A533CCACB3A1CE9DBF1A8A430A1 \ No newline at end of file +40220A533CCACB3A1CE9DBF1A8A430A1 +EEB29D1DDA3A3015BC645A989B5BD38E \ No newline at end of file diff --git a/lib/web/controllers/application_controller.ex b/lib/web/controllers/application_controller.ex index ef5067da4..7ef7d5600 100644 --- a/lib/web/controllers/application_controller.ex +++ b/lib/web/controllers/application_controller.ex @@ -13,7 +13,7 @@ defmodule Mobilizon.Web.ApplicationController do @spec create_application(Plug.Conn.t(), map()) :: Plug.Conn.t() def create_application( conn, - %{"name" => name, "redirect_uris" => redirect_uris, "scope" => scope} = args + %{"name" => name, "redirect_uri" => redirect_uris, "scope" => scope} = args ) do ip = conn.remote_ip |> :inet.ntoa() |> to_string() @@ -33,7 +33,9 @@ defmodule Mobilizon.Web.ApplicationController do conn |> Plug.Conn.put_resp_header("cache-control", "no-store") |> json( - Map.take(app, [:name, :website, :redirect_uris, :client_id, :client_secret, :scope]) + app + |> Map.take([:name, :website, :client_id, :client_secret, :scope]) + |> Map.put(:redirect_uri, app.redirect_uris) ) {:error, :invalid_scope} -> diff --git a/test/web/controllers/application_controller_test.exs b/test/web/controllers/application_controller_test.exs index 196791ade..52215ad81 100644 --- a/test/web/controllers/application_controller_test.exs +++ b/test/web/controllers/application_controller_test.exs @@ -24,7 +24,7 @@ defmodule Mobilizon.Web.ApplicationControllerTest do conn |> post("/apps", %{ "name" => "hello", - "redirect_uris" => "hello", + "redirect_uri" => "hello", "scope" => "write nothing" }) @@ -46,14 +46,14 @@ defmodule Mobilizon.Web.ApplicationControllerTest do conn |> post("/apps", %{ "name" => name, - "redirect_uris" => Enum.join(redirect_uris, "\n"), + "redirect_uri" => Enum.join(redirect_uris, "\n"), "scope" => scope, "website" => website }) assert %{ "name" => ^name, - "redirect_uris" => ^redirect_uris, + "redirect_uri" => ^redirect_uris, "scope" => ^scope, "website" => ^website, "client_id" => _client_id,