Save context in likes / announces.
authorRoger Braun <roger@rogerbraun.net>
Tue, 2 May 2017 13:54:14 +0000 (15:54 +0200)
committerRoger Braun <roger@rogerbraun.net>
Tue, 2 May 2017 13:54:14 +0000 (15:54 +0200)
lib/pleroma/web/activity_pub/activity_pub.ex
test/web/activity_pub/activity_pub_test.exs

index 0fb8db52048b0390cf1569dc4b23238df6a018fb..e9de3573e59597579e546993e75001b9887d7de2 100644 (file)
@@ -55,7 +55,8 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
           "type" => "Like",
           "actor" => ap_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)
@@ -177,7 +178,8 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
       "type" => "Announce",
       "actor" => ap_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)
index 744021c8cb21a4414b5cf453951d6b47b86a156d..6e42fbda278adca6db52484904751a38e3c46bf7 100644 (file)
@@ -125,6 +125,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubTest do
       assert like_activity.data["type"] == "Like"
       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["context"] == object.data["context"]
       assert object.data["like_count"] == 1
       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["object"] == object.data["id"]
       assert announce_activity.data["actor"] == user.ap_id
+      assert announce_activity.data["context"] == object.data["context"]
     end
   end