summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorlain <lain@soykaf.club>2018-02-18 14:14:16 +0100
committerlain <lain@soykaf.club>2018-02-18 14:14:16 +0100
commit539340d914e5c124d3583abe1ee4e6a69620b873 (patch)
tree1482044daf664a430f7f8d721d588004700ded48 /lib
parent20e6190ead59eb9bd83887b8239cab73c17a961b (diff)
downloadpleroma-539340d914e5c124d3583abe1ee4e6a69620b873.tar.gz
pleroma-539340d914e5c124d3583abe1ee4e6a69620b873.zip
Handle sensitive property.
Diffstat (limited to 'lib')
-rw-r--r--lib/pleroma/web/mastodon_api/views/status_view.ex2
-rw-r--r--lib/pleroma/web/twitter_api/representers/activity_representer.ex4
2 files changed, 4 insertions, 2 deletions
diff --git a/lib/pleroma/web/mastodon_api/views/status_view.ex b/lib/pleroma/web/mastodon_api/views/status_view.ex
index e205a420d..d859fc851 100644
--- a/lib/pleroma/web/mastodon_api/views/status_view.ex
+++ b/lib/pleroma/web/mastodon_api/views/status_view.ex
@@ -58,7 +58,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusView do
announcement_count = object["announcement_count"] || 0
tags = object["tag"] || []
- sensitive = Enum.member?(tags, "nsfw")
+ sensitive = object["sensitive"] || Enum.member?(tags, "nsfw")
mentions = activity.data["to"]
|> Enum.map(fn (ap_id) -> User.get_cached_by_ap_id(ap_id) end)
diff --git a/lib/pleroma/web/twitter_api/representers/activity_representer.ex b/lib/pleroma/web/twitter_api/representers/activity_representer.ex
index 1f11bc9ac..f9f9bd7b4 100644
--- a/lib/pleroma/web/twitter_api/representers/activity_representer.ex
+++ b/lib/pleroma/web/twitter_api/representers/activity_representer.ex
@@ -133,7 +133,9 @@ defmodule Pleroma.Web.TwitterAPI.Representers.ActivityRepresenter do
conversation_id = conversation_id(activity)
tags = activity.data["object"]["tag"] || []
- possibly_sensitive = Enum.member?(tags, "nsfw")
+ possibly_sensitive = activity.data["object"]["sensitive"] || Enum.member?(tags, "nsfw")
+
+ tags = if possibly_sensitive, do: ["nsfw" | tags], else: tags
summary = activity.data["object"]["summary"]
content = if !!summary and summary != "" do