Make likes and announces public.

This commit is contained in:
lain 2018-02-25 18:20:06 +01:00
parent 8a47974217
commit f61fd00db5
2 changed files with 5 additions and 0 deletions

View File

@ -109,6 +109,7 @@ def make_like_data(%User{ap_id: ap_id} = actor, %{data: %{"id" => id}} = object,
"actor" => ap_id, "actor" => ap_id,
"object" => id, "object" => id,
"to" => [actor.follower_address, object.data["actor"]], "to" => [actor.follower_address, object.data["actor"]],
"cc" => ["https://www.w3.org/ns/activitystreams#Public"],
"context" => object.data["context"] "context" => object.data["context"]
} }
@ -150,6 +151,7 @@ def make_follow_data(%User{ap_id: follower_id}, %User{ap_id: followed_id}, activ
"type" => "Follow", "type" => "Follow",
"actor" => follower_id, "actor" => follower_id,
"to" => [followed_id], "to" => [followed_id],
"cc" => ["https://www.w3.org/ns/activitystreams#Public"],
"object" => followed_id "object" => followed_id
} }
@ -177,6 +179,7 @@ def make_announce_data(%User{ap_id: ap_id} = user, %Object{data: %{"id" => id}}
"actor" => ap_id, "actor" => ap_id,
"object" => id, "object" => id,
"to" => [user.follower_address, object.data["actor"]], "to" => [user.follower_address, object.data["actor"]],
"cc" => ["https://www.w3.org/ns/activitystreams#Public"],
"context" => object.data["context"] "context" => object.data["context"]
} }

View File

@ -121,6 +121,7 @@ test "an announce activity" do
#{note_xml} #{note_xml}
</activity:object> </activity:object>
<link rel="mentioned" ostatus:object-type="http://activitystrea.ms/schema/1.0/person" href="#{note.data["actor"]}"/> <link rel="mentioned" ostatus:object-type="http://activitystrea.ms/schema/1.0/person" href="#{note.data["actor"]}"/>
<link rel="mentioned" ostatus:object-type="http://activitystrea.ms/schema/1.0/collection" href="http://activityschema.org/collection/public"/>
""" """
announce_xml = ActivityRepresenter.to_simple_form(announce, user) announce_xml = ActivityRepresenter.to_simple_form(announce, user)
@ -156,6 +157,7 @@ test "a like activity" do
<link rel="self" type="application/atom+xml" href="#{like.data["id"]}"/> <link rel="self" type="application/atom+xml" href="#{like.data["id"]}"/>
<thr:in-reply-to ref="#{note.data["id"]}" /> <thr:in-reply-to ref="#{note.data["id"]}" />
<link rel="mentioned" ostatus:object-type="http://activitystrea.ms/schema/1.0/person" href="#{note.data["actor"]}"/> <link rel="mentioned" ostatus:object-type="http://activitystrea.ms/schema/1.0/person" href="#{note.data["actor"]}"/>
<link rel="mentioned" ostatus:object-type="http://activitystrea.ms/schema/1.0/collection" href="http://activityschema.org/collection/public"/>
""" """
assert clean(res) == clean(expected) assert clean(res) == clean(expected)