Set twitter-style possibly_sensitive boolena.

This commit is contained in:
Roger Braun 2017-08-24 16:27:37 +02:00
parent 5dc278b1a6
commit 67bfa19b35
2 changed files with 8 additions and 3 deletions

View file

@ -112,6 +112,9 @@ defmodule Pleroma.Web.TwitterAPI.Representers.ActivityRepresenter do
conversation_id = conversation_id(activity)
tags = activity.data["object"]["tag"] || []
possibly_sensitive = Enum.member?(tags, "nsfw")
%{
"id" => activity.id,
"user" => UserView.render("show.json", %{user: user, for: opts[:for]}),
@ -129,8 +132,9 @@ defmodule Pleroma.Web.TwitterAPI.Representers.ActivityRepresenter do
"favorited" => to_boolean(favorited),
"repeated" => to_boolean(repeated),
"external_url" => object["external_url"],
"tags" => activity.data["object"]["tag"] || [],
"activity_type" => "post"
"tags" => tags,
"activity_type" => "post",
"possibly_sensitive" => possibly_sensitive
}
end

View file

@ -130,7 +130,8 @@ defmodule Pleroma.Web.TwitterAPI.Representers.ActivityRepresenterTest do
"repeated" => false,
"external_url" => "some url",
"tags" => ["content", "mentioning", "nsfw"],
"activity_type" => "post"
"activity_type" => "post",
"possibly_sensitive" => true
}
assert ActivityRepresenter.to_map(activity, %{user: user, for: follower, mentioned: [mentioned_user]}) == expected_status