diff options
author | lain <lain@soykaf.club> | 2020-05-01 12:48:56 +0000 |
---|---|---|
committer | lain <lain@soykaf.club> | 2020-05-01 12:48:56 +0000 |
commit | 607e06c245e8a36d7b720d71b45e1fc962ede3ab (patch) | |
tree | 00931f919f1abc7943ea2008100f5093f0d21457 /lib/pleroma/web/common_api/common_api.ex | |
parent | 44fbd09709b43a7eedff60365c3ff487dbd7a5c9 (diff) | |
parent | 1898054da4bcccb25e0bcd9d6463af38ced43351 (diff) | |
download | pleroma-607e06c245e8a36d7b720d71b45e1fc962ede3ab.tar.gz |
Merge branch 'openapi/reports' into 'develop'
Add OpenAPI spec for ReportController
See merge request pleroma/pleroma!2434
Diffstat (limited to 'lib/pleroma/web/common_api/common_api.ex')
-rw-r--r-- | lib/pleroma/web/common_api/common_api.ex | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/lib/pleroma/web/common_api/common_api.ex b/lib/pleroma/web/common_api/common_api.ex index 4112e441a..4618b4bbf 100644 --- a/lib/pleroma/web/common_api/common_api.ex +++ b/lib/pleroma/web/common_api/common_api.ex @@ -382,9 +382,9 @@ defmodule Pleroma.Web.CommonAPI do ThreadMute.exists?(user.id, activity.data["context"]) end - def report(user, %{"account_id" => account_id} = data) do - with {:ok, account} <- get_reported_account(account_id), - {:ok, {content_html, _, _}} <- make_report_content_html(data["comment"]), + def report(user, data) do + with {:ok, account} <- get_reported_account(data.account_id), + {:ok, {content_html, _, _}} <- make_report_content_html(data[:comment]), {:ok, statuses} <- get_report_statuses(account, data) do ActivityPub.flag(%{ context: Utils.generate_context_id(), @@ -392,13 +392,11 @@ defmodule Pleroma.Web.CommonAPI do account: account, statuses: statuses, content: content_html, - forward: data["forward"] || false + forward: Map.get(data, :forward, false) }) end end - def report(_user, _params), do: {:error, dgettext("errors", "Valid `account_id` required")} - defp get_reported_account(account_id) do case User.get_cached_by_id(account_id) do %User{} = account -> {:ok, account} |