aboutsummaryrefslogtreecommitdiff
path: root/lib/pleroma/web/common_api/utils.ex
diff options
context:
space:
mode:
authorkaniini <nenolod@gmail.com>2019-03-22 00:50:24 +0000
committerkaniini <nenolod@gmail.com>2019-03-22 00:50:24 +0000
commit1c3d3d0c2b6ebb4948df0b4ec085bcc4a564a126 (patch)
treeda2492e2a4d7e1202e82bff3fbe4d89ddd8b85c5 /lib/pleroma/web/common_api/utils.ex
parentb548181b52c4397d5034cfd95b2ef7e05c9c9c22 (diff)
parentbf27190f7f0942a05de518f2085a299eb011614c (diff)
downloadpleroma-1c3d3d0c2b6ebb4948df0b4ec085bcc4a564a126.tar.gz
Merge branch 'safe-mentions' into 'develop'
Add safe dm mode option. See merge request pleroma/pleroma!958
Diffstat (limited to 'lib/pleroma/web/common_api/utils.ex')
-rw-r--r--lib/pleroma/web/common_api/utils.ex12
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/pleroma/web/common_api/utils.ex b/lib/pleroma/web/common_api/utils.ex
index fcdfea8e1..3e807a5b7 100644
--- a/lib/pleroma/web/common_api/utils.ex
+++ b/lib/pleroma/web/common_api/utils.ex
@@ -101,7 +101,8 @@ defmodule Pleroma.Web.CommonAPI.Utils do
def make_content_html(
status,
attachments,
- data
+ data,
+ visibility
) do
no_attachment_links =
data
@@ -110,8 +111,15 @@ defmodule Pleroma.Web.CommonAPI.Utils do
content_type = get_content_type(data["content_type"])
+ options =
+ if visibility == "direct" && Config.get([:instance, :safe_dm_mentions]) do
+ [safe_mention: true]
+ else
+ []
+ end
+
status
- |> format_input(content_type)
+ |> format_input(content_type, options)
|> maybe_add_attachments(attachments, no_attachment_links)
|> maybe_add_nsfw_tag(data)
end