diff options
author | Roger Braun <roger@rogerbraun.net> | 2017-05-03 16:08:24 +0200 |
---|---|---|
committer | Roger Braun <roger@rogerbraun.net> | 2017-05-03 16:08:24 +0200 |
commit | df71c142cfadaae8866303768bca00c343b8bed1 (patch) | |
tree | 0b7336976740466acaaa1f823e0eba2614a470ed | |
parent | 8141024259ee4bebd58d6ecd963f181aad420846 (diff) | |
download | pleroma-df71c142cfadaae8866303768bca00c343b8bed1.tar.gz |
Remove doubled 'to' recipients.
-rw-r--r-- | lib/pleroma/web/activity_pub/activity_pub.ex | 2 | ||||
-rw-r--r-- | test/web/activity_pub/activity_pub_test.exs | 7 |
2 files changed, 8 insertions, 1 deletions
diff --git a/lib/pleroma/web/activity_pub/activity_pub.ex b/lib/pleroma/web/activity_pub/activity_pub.ex index 194a5ec3d..f18f3df2e 100644 --- a/lib/pleroma/web/activity_pub/activity_pub.ex +++ b/lib/pleroma/web/activity_pub/activity_pub.ex @@ -24,7 +24,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do activity = %{ "type" => "Create", - "to" => to, + "to" => to |> Enum.uniq, "actor" => actor.ap_id, "object" => object, "published" => published, diff --git a/test/web/activity_pub/activity_pub_test.exs b/test/web/activity_pub/activity_pub_test.exs index 6e42fbda2..dfa73b775 100644 --- a/test/web/activity_pub/activity_pub_test.exs +++ b/test/web/activity_pub/activity_pub_test.exs @@ -40,6 +40,13 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubTest do end end + describe "create activities" do + test "removes doubled 'to' recipients" do + {:ok, activity} = ActivityPub.create(["user1", "user1", "user2"], %User{ap_id: "1"}, "", %{}) + assert activity.data["to"] == ["user1", "user2"] + end + end + describe "fetch activities for recipients" do test "retrieve the activities for certain recipients" do {:ok, activity_one} = ActivityBuilder.insert(%{"to" => ["someone"]}) |