Save context in likes / announces.

This commit is contained in:
Roger Braun 2017-05-02 15:54:14 +02:00
parent 16f8406eb6
commit a3e82c5c24
2 changed files with 6 additions and 2 deletions

View file

@ -55,7 +55,8 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
"type" => "Like", "type" => "Like",
"actor" => ap_id, "actor" => ap_id,
"object" => id, "object" => id,
"to" => [User.ap_followers(user), object.data["actor"]] "to" => [User.ap_followers(user), object.data["actor"]],
"context" => object.data["context"]
} }
{:ok, activity} = insert(data) {:ok, activity} = insert(data)
@ -177,7 +178,8 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
"type" => "Announce", "type" => "Announce",
"actor" => ap_id, "actor" => ap_id,
"object" => id, "object" => id,
"to" => [User.ap_followers(user), object.data["actor"]] "to" => [User.ap_followers(user), object.data["actor"]],
"context" => object.data["context"]
} }
{:ok, activity} = insert(data) {:ok, activity} = insert(data)

View file

@ -125,6 +125,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubTest do
assert like_activity.data["type"] == "Like" assert like_activity.data["type"] == "Like"
assert like_activity.data["object"] == object.data["id"] assert like_activity.data["object"] == object.data["id"]
assert like_activity.data["to"] == [User.ap_followers(user), note_activity.data["actor"]] assert like_activity.data["to"] == [User.ap_followers(user), note_activity.data["actor"]]
assert like_activity.data["context"] == object.data["context"]
assert object.data["like_count"] == 1 assert object.data["like_count"] == 1
assert object.data["likes"] == [user.ap_id] assert object.data["likes"] == [user.ap_id]
@ -174,6 +175,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubTest do
assert announce_activity.data["to"] == [User.ap_followers(user), note_activity.data["actor"]] assert announce_activity.data["to"] == [User.ap_followers(user), note_activity.data["actor"]]
assert announce_activity.data["object"] == object.data["id"] assert announce_activity.data["object"] == object.data["id"]
assert announce_activity.data["actor"] == user.ap_id assert announce_activity.data["actor"] == user.ap_id
assert announce_activity.data["context"] == object.data["context"]
end end
end end