Commit 67bfa19b authored by lain's avatar lain
Browse files

Set twitter-style possibly_sensitive boolena.

parent 5dc278b1
......@@ -112,6 +112,9 @@ def to_map(%Activity{data: %{"object" => %{"content" => content} = object}} = ac
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 @@ def to_map(%Activity{data: %{"object" => %{"content" => content} = object}} = ac
"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
......
......@@ -130,7 +130,8 @@ test "an activity" 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
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment