2019-09-30 04:04:03 -06:00
|
|
|
# Pleroma: A lightweight social networking server
|
2020-03-03 15:44:49 -07:00
|
|
|
# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
|
2019-09-30 04:04:03 -06:00
|
|
|
# SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
|
|
|
defmodule Pleroma.Web.MastodonAPI.ReportController do
|
|
|
|
use Pleroma.Web, :controller
|
|
|
|
|
|
|
|
action_fallback(Pleroma.Web.MastodonAPI.FallbackController)
|
|
|
|
|
2020-05-04 10:16:18 -06:00
|
|
|
plug(Pleroma.Web.ApiSpec.CastAndValidate)
|
2020-06-24 00:57:27 -06:00
|
|
|
plug(Pleroma.Web.Plugs.OAuthScopesPlug, %{scopes: ["write:reports"]} when action == :create)
|
2019-10-06 08:12:17 -06:00
|
|
|
|
2020-04-28 06:50:37 -06:00
|
|
|
defdelegate open_api_operation(action), to: Pleroma.Web.ApiSpec.ReportOperation
|
|
|
|
|
2019-09-30 04:04:03 -06:00
|
|
|
@doc "POST /api/v1/reports"
|
2020-04-28 06:50:37 -06:00
|
|
|
def create(%{assigns: %{user: user}, body_params: params} = conn, _) do
|
2019-09-30 04:04:03 -06:00
|
|
|
with {:ok, activity} <- Pleroma.Web.CommonAPI.report(user, params) do
|
|
|
|
render(conn, "show.json", activity: activity)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|