Reports
This commit is contained in:
parent
77fb926afa
commit
bff9eb5ef7
18 changed files with 347 additions and 5 deletions
|
|
@ -24,6 +24,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
|
|||
alias Pleroma.Web.MastodonAPI.MastodonView
|
||||
alias Pleroma.Web.MastodonAPI.PushSubscriptionView
|
||||
alias Pleroma.Web.MastodonAPI.StatusView
|
||||
alias Pleroma.Web.MastodonAPI.ReportView
|
||||
alias Pleroma.Web.ActivityPub.ActivityPub
|
||||
alias Pleroma.Web.ActivityPub.Utils
|
||||
alias Pleroma.Web.OAuth.App
|
||||
|
|
@ -1533,6 +1534,20 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
|
|||
end
|
||||
end
|
||||
|
||||
def reports(%{assigns: %{user: user}} = conn, params) do
|
||||
case CommonAPI.report(user, params) do
|
||||
{:ok, activity} ->
|
||||
conn
|
||||
|> put_view(ReportView)
|
||||
|> try_render("report.json", %{activity: activity})
|
||||
|
||||
{:error, err} ->
|
||||
conn
|
||||
|> put_status(:bad_request)
|
||||
|> json(%{error: err})
|
||||
end
|
||||
end
|
||||
|
||||
def try_render(conn, target, params)
|
||||
when is_binary(target) do
|
||||
res = render(conn, target, params)
|
||||
|
|
|
|||
14
lib/pleroma/web/mastodon_api/views/report_view.ex
Normal file
14
lib/pleroma/web/mastodon_api/views/report_view.ex
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
# 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.ReportView do
|
||||
use Pleroma.Web, :view
|
||||
|
||||
def render("report.json", %{activity: activity}) do
|
||||
%{
|
||||
id: to_string(activity.id),
|
||||
action_taken: false
|
||||
}
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue