diff options
author | Egor <egor@kislitsyn.com> | 2019-02-20 16:51:25 +0000 |
---|---|---|
committer | kaniini <nenolod@gmail.com> | 2019-02-20 16:51:25 +0000 |
commit | bff9eb5ef7ad446376f68807d4e51db5f2de9515 (patch) | |
tree | d1c2525ccfbee6e8e468e77611e46c7797e12d71 /lib/pleroma/web/common_api/utils.ex | |
parent | 77fb926afa53a6d156729b1dd1613e1fed0c7910 (diff) | |
download | pleroma-bff9eb5ef7ad446376f68807d4e51db5f2de9515.tar.gz |
Reports
Diffstat (limited to 'lib/pleroma/web/common_api/utils.ex')
-rw-r--r-- | lib/pleroma/web/common_api/utils.ex | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/pleroma/web/common_api/utils.ex b/lib/pleroma/web/common_api/utils.ex index abdeee947..1d3a314ce 100644 --- a/lib/pleroma/web/common_api/utils.ex +++ b/lib/pleroma/web/common_api/utils.ex @@ -322,4 +322,22 @@ defmodule Pleroma.Web.CommonAPI.Utils do end def maybe_extract_mentions(_), do: [] + + def make_report_content_html(nil), do: {:ok, nil} + + def make_report_content_html(comment) do + max_size = Pleroma.Config.get([:instance, :max_report_comment_size], 1000) + + if String.length(comment) <= max_size do + {:ok, format_input(comment, [], [], "text/plain")} + else + {:error, "Comment must be up to #{max_size} characters"} + end + end + + def get_report_statuses(%User{ap_id: actor}, %{"status_ids" => status_ids}) do + {:ok, Activity.all_by_actor_and_id(actor, status_ids)} + end + + def get_report_statuses(_, _), do: {:ok, nil} end |