From: Egor Kislitsyn Date: Thu, 30 Apr 2020 09:51:27 +0000 (+0400) Subject: Merge branch 'develop' into openapi/reports X-Git-Url: https://git.squeep.com/?a=commitdiff_plain;h=1898054da4bcccb25e0bcd9d6463af38ced43351;p=akkoma Merge branch 'develop' into openapi/reports --- 1898054da4bcccb25e0bcd9d6463af38ced43351 diff --cc lib/pleroma/web/mastodon_api/controllers/report_controller.ex index 85bd52106,9fbaa7bd1..f65c5c62b --- a/lib/pleroma/web/mastodon_api/controllers/report_controller.ex +++ b/lib/pleroma/web/mastodon_api/controllers/report_controller.ex @@@ -9,14 -9,10 +9,13 @@@ defmodule Pleroma.Web.MastodonAPI.Repor action_fallback(Pleroma.Web.MastodonAPI.FallbackController) + plug(OpenApiSpex.Plug.CastAndValidate, render_error: Pleroma.Web.ApiSpec.RenderError) plug(OAuthScopesPlug, %{scopes: ["write:reports"]} when action == :create) - plug(Pleroma.Plugs.EnsurePublicOrAuthenticatedPlug) + defdelegate open_api_operation(action), to: Pleroma.Web.ApiSpec.ReportOperation + @doc "POST /api/v1/reports" - def create(%{assigns: %{user: user}} = conn, params) do + def create(%{assigns: %{user: user}, body_params: params} = conn, _) do with {:ok, activity} <- Pleroma.Web.CommonAPI.report(user, params) do render(conn, "show.json", activity: activity) end