Federate out content warnings.

This commit is contained in:
Roger Braun 2017-10-31 19:51:58 +01:00
parent e014cc6ed8
commit 6f05367325
2 changed files with 9 additions and 1 deletions

View File

@ -83,6 +83,12 @@ defmodule Pleroma.Web.OStatus.ActivityRepresenter do
emoji_links = get_emoji_links(activity.data["object"]["content"] || "") emoji_links = get_emoji_links(activity.data["object"]["content"] || "")
summary = if activity.data["object"]["summary"] do
[{:summary, [], h.(activity.data["object"]["summary"])}]
else
[]
end
[ [
{:"activity:object-type", ['http://activitystrea.ms/schema/1.0/note']}, {:"activity:object-type", ['http://activitystrea.ms/schema/1.0/note']},
{:"activity:verb", ['http://activitystrea.ms/schema/1.0/post']}, {:"activity:verb", ['http://activitystrea.ms/schema/1.0/post']},
@ -93,7 +99,7 @@ defmodule Pleroma.Web.OStatus.ActivityRepresenter do
{:updated, h.(updated_at)}, {:updated, h.(updated_at)},
{:"ostatus:conversation", [ref: h.(activity.data["context"])], h.(activity.data["context"])}, {:"ostatus:conversation", [ref: h.(activity.data["context"])], h.(activity.data["context"])},
{:link, [ref: h.(activity.data["context"]), rel: 'ostatus:conversation'], []}, {:link, [ref: h.(activity.data["context"]), rel: 'ostatus:conversation'], []},
] ++ get_links(activity) ++ categories ++ attachments ++ in_reply_to ++ author ++ mentions ++ emoji_links ] ++ summary ++ get_links(activity) ++ categories ++ attachments ++ in_reply_to ++ author ++ mentions ++ emoji_links
end end
def to_simple_form(%{data: %{"type" => "Like"}} = activity, user, with_author) do def to_simple_form(%{data: %{"type" => "Like"}} = activity, user, with_author) do

View File

@ -36,6 +36,7 @@ defmodule Pleroma.Web.OStatus.ActivityRepresenterTest do
<updated>#{note_activity.data["object"]["published"]}</updated> <updated>#{note_activity.data["object"]["published"]}</updated>
<ostatus:conversation ref="#{note_activity.data["context"]}">#{note_activity.data["context"]}</ostatus:conversation> <ostatus:conversation ref="#{note_activity.data["context"]}">#{note_activity.data["context"]}</ostatus:conversation>
<link ref="#{note_activity.data["context"]}" rel="ostatus:conversation" /> <link ref="#{note_activity.data["context"]}" rel="ostatus:conversation" />
<summary>#{note_activity.data["object"]["summary"]}</summary>
<link type="application/atom+xml" href="#{note_activity.data["object"]["id"]}" rel="self" /> <link type="application/atom+xml" href="#{note_activity.data["object"]["id"]}" rel="self" />
<link type="text/html" href="#{note_activity.data["object"]["id"]}" rel="alternate" /> <link type="text/html" href="#{note_activity.data["object"]["id"]}" rel="alternate" />
<category term="2hu"/> <category term="2hu"/>
@ -74,6 +75,7 @@ defmodule Pleroma.Web.OStatus.ActivityRepresenterTest do
<updated>#{answer.data["object"]["published"]}</updated> <updated>#{answer.data["object"]["published"]}</updated>
<ostatus:conversation ref="#{answer.data["context"]}">#{answer.data["context"]}</ostatus:conversation> <ostatus:conversation ref="#{answer.data["context"]}">#{answer.data["context"]}</ostatus:conversation>
<link ref="#{answer.data["context"]}" rel="ostatus:conversation" /> <link ref="#{answer.data["context"]}" rel="ostatus:conversation" />
<summary>2hu</summary>
<link type="application/atom+xml" href="#{answer.data["object"]["id"]}" rel="self" /> <link type="application/atom+xml" href="#{answer.data["object"]["id"]}" rel="self" />
<link type="text/html" href="#{answer.data["object"]["id"]}" rel="alternate" /> <link type="text/html" href="#{answer.data["object"]["id"]}" rel="alternate" />
<category term="2hu"/> <category term="2hu"/>