2019-09-30 10:04:03 +00:00
|
|
|
# Pleroma: A lightweight social networking server
|
|
|
|
# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/>
|
|
|
|
# SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
|
|
|
defmodule Pleroma.Web.MastodonAPI.ReportController do
|
2019-10-02 17:42:40 +00:00
|
|
|
alias Pleroma.Plugs.OAuthScopesPlug
|
|
|
|
|
2019-09-30 10:04:03 +00:00
|
|
|
use Pleroma.Web, :controller
|
|
|
|
|
|
|
|
action_fallback(Pleroma.Web.MastodonAPI.FallbackController)
|
|
|
|
|
2019-10-02 17:42:40 +00:00
|
|
|
plug(OAuthScopesPlug, %{scopes: ["write:reports"]} when action == :create)
|
|
|
|
|
2019-10-06 14:12:17 +00:00
|
|
|
plug(Pleroma.Plugs.EnsurePublicOrAuthenticatedPlug)
|
|
|
|
|
2019-09-30 10:04:03 +00:00
|
|
|
@doc "POST /api/v1/reports"
|
|
|
|
def create(%{assigns: %{user: user}} = conn, params) do
|
|
|
|
with {:ok, activity} <- Pleroma.Web.CommonAPI.report(user, params) do
|
|
|
|
render(conn, "show.json", activity: activity)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|