diff options
author | Egor Kislitsyn <egor@kislitsyn.com> | 2019-05-24 21:05:57 +0700 |
---|---|---|
committer | Egor Kislitsyn <egor@kislitsyn.com> | 2019-05-24 21:05:57 +0700 |
commit | f333041a0a2b9c2f1ef2236254b8dd3e9a55a688 (patch) | |
tree | 317be4a8b7c0b9a231853ee05547554f5da74c3f /lib/pleroma/web/common_api | |
parent | 3b71612d3d8b5e2ad53bda4399eb7f687cd6c30e (diff) | |
parent | 6499adc6a83b4064f7283de3c729053e62ade7b2 (diff) | |
download | pleroma-f333041a0a2b9c2f1ef2236254b8dd3e9a55a688.tar.gz |
Merge remote-tracking branch 'pleroma/develop' into feature/addressable-lists
Diffstat (limited to 'lib/pleroma/web/common_api')
-rw-r--r-- | lib/pleroma/web/common_api/common_api.ex | 4 | ||||
-rw-r--r-- | lib/pleroma/web/common_api/utils.ex | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/lib/pleroma/web/common_api/common_api.ex b/lib/pleroma/web/common_api/common_api.ex index a08075bc2..e8199200e 100644 --- a/lib/pleroma/web/common_api/common_api.ex +++ b/lib/pleroma/web/common_api/common_api.ex @@ -163,6 +163,7 @@ defmodule Pleroma.Web.CommonAPI do bcc <- bcc_for_list(user, visibility), context <- make_context(in_reply_to), cw <- data["spoiler_text"] || "", + sensitive <- data["sensitive"] || Enum.member?(tags, {"#nsfw", "nsfw"}), full_payload <- String.trim(status <> cw), length when length in 1..limit <- String.length(full_payload), object <- @@ -175,7 +176,8 @@ defmodule Pleroma.Web.CommonAPI do in_reply_to, tags, cw, - cc + cc, + sensitive ), object <- Map.put( diff --git a/lib/pleroma/web/common_api/utils.ex b/lib/pleroma/web/common_api/utils.ex index a463c1f98..d97a80dd5 100644 --- a/lib/pleroma/web/common_api/utils.ex +++ b/lib/pleroma/web/common_api/utils.ex @@ -232,7 +232,8 @@ defmodule Pleroma.Web.CommonAPI.Utils do in_reply_to, tags, cw \\ nil, - cc \\ [] + cc \\ [], + sensitive \\ false ) do object = %{ "type" => "Note", @@ -240,6 +241,7 @@ defmodule Pleroma.Web.CommonAPI.Utils do "cc" => cc, "content" => content_html, "summary" => cw, + "sensitive" => !Enum.member?(["false", "False", "0", false], sensitive), "context" => context, "attachment" => attachments, "actor" => actor, |