aboutsummaryrefslogtreecommitdiff
path: root/lib/pleroma/web/common_api/utils.ex
diff options
context:
space:
mode:
authorAlex Gleason <alex@alexgleason.me>2021-06-04 21:12:37 -0500
committerAlex Gleason <alex@alexgleason.me>2021-06-04 21:12:37 -0500
commit3be08e7c2ec8b77e02e3d0572227221d68163df0 (patch)
tree0f1d9ab79c29060edd3f95c4795e634a10d1a5a3 /lib/pleroma/web/common_api/utils.ex
parent1c3fe43d231428fee392afd726363193fdcb8008 (diff)
parent94687e23938b808a3fff95c92956ec337160cd0b (diff)
downloadpleroma-3be08e7c2ec8b77e02e3d0572227221d68163df0.tar.gz
Merge remote-tracking branch 'pleroma/develop' into cycles-reverse-proxy
Diffstat (limited to 'lib/pleroma/web/common_api/utils.ex')
-rw-r--r--lib/pleroma/web/common_api/utils.ex12
1 files changed, 2 insertions, 10 deletions
diff --git a/lib/pleroma/web/common_api/utils.ex b/lib/pleroma/web/common_api/utils.ex
index 9587dfa25..4cc34002d 100644
--- a/lib/pleroma/web/common_api/utils.ex
+++ b/lib/pleroma/web/common_api/utils.ex
@@ -69,7 +69,7 @@ defmodule Pleroma.Web.CommonAPI.Utils do
to =
case visibility do
"public" -> [Pleroma.Constants.as_public() | draft.mentions]
- "local" -> [Pleroma.Constants.as_local_public() | draft.mentions]
+ "local" -> [Utils.as_local_public() | draft.mentions]
end
cc = [draft.user.follower_address]
@@ -217,7 +217,6 @@ defmodule Pleroma.Web.CommonAPI.Utils do
draft.status
|> format_input(content_type, options)
|> maybe_add_attachments(draft.attachments, attachment_links)
- |> maybe_add_nsfw_tag(draft.params)
end
defp get_content_type(content_type) do
@@ -228,13 +227,6 @@ defmodule Pleroma.Web.CommonAPI.Utils do
end
end
- defp maybe_add_nsfw_tag({text, mentions, tags}, %{"sensitive" => sensitive})
- when sensitive in [true, "True", "true", "1"] do
- {text, mentions, [{"#nsfw", "nsfw"} | tags]}
- end
-
- defp maybe_add_nsfw_tag(data, _), do: data
-
def make_context(_, %Participation{} = participation) do
Repo.preload(participation, :conversation).conversation.ap_id
end
@@ -294,7 +286,7 @@ defmodule Pleroma.Web.CommonAPI.Utils do
def format_input(text, "text/markdown", options) do
text
|> Formatter.mentions_escape(options)
- |> Earmark.as_html!(%Earmark.Options{renderer: Pleroma.EarmarkRenderer})
+ |> Formatter.markdown_to_html()
|> Formatter.linkify(options)
|> Formatter.html_escape("text/html")
end