summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorHaelwenn <contact+git.pleroma.social@hacktivis.me>2019-04-16 18:38:11 +0000
committerHaelwenn <contact+git.pleroma.social@hacktivis.me>2019-04-16 18:38:11 +0000
commitcde7711b12d64081f16e88a3f3ac93c811471d61 (patch)
tree52df398c08d2b6f9135d561a80968677d119c712 /test
parent6ddaeb14e20f3a398234b4b390feefd298fe61b9 (diff)
parent750b369d0469ba7ec037ff953e65473e32d7fa33 (diff)
downloadpleroma-cde7711b12d64081f16e88a3f3ac93c811471d61.tar.gz
pleroma-cde7711b12d64081f16e88a3f3ac93c811471d61.zip
Merge branch 'bugfix/relax-spam-protection' into 'develop'
activitypub: allow indirect messages from users being followed at a personal inbox See merge request pleroma/pleroma!1069
Diffstat (limited to 'test')
-rw-r--r--test/web/activity_pub/activity_pub_controller_test.exs30
1 files changed, 30 insertions, 0 deletions
diff --git a/test/web/activity_pub/activity_pub_controller_test.exs b/test/web/activity_pub/activity_pub_controller_test.exs
index 8dd8e7e0a..7b1c60f15 100644
--- a/test/web/activity_pub/activity_pub_controller_test.exs
+++ b/test/web/activity_pub/activity_pub_controller_test.exs
@@ -253,6 +253,36 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubControllerTest do
assert Activity.get_by_ap_id(data["id"])
end
+ test "it accepts messages from actors that are followed by the user", %{conn: conn} do
+ recipient = insert(:user)
+ actor = insert(:user, %{ap_id: "http://mastodon.example.org/users/actor"})
+
+ {:ok, recipient} = User.follow(recipient, actor)
+
+ data =
+ File.read!("test/fixtures/mastodon-post-activity.json")
+ |> Poison.decode!()
+
+ object =
+ data["object"]
+ |> Map.put("attributedTo", actor.ap_id)
+
+ data =
+ data
+ |> Map.put("actor", actor.ap_id)
+ |> Map.put("object", object)
+
+ conn =
+ conn
+ |> assign(:valid_signature, true)
+ |> put_req_header("content-type", "application/activity+json")
+ |> post("/users/#{recipient.nickname}/inbox", data)
+
+ assert "ok" == json_response(conn, 200)
+ :timer.sleep(500)
+ assert Activity.get_by_ap_id(data["id"])
+ end
+
test "it rejects reads from other users", %{conn: conn} do
user = insert(:user)
otheruser = insert(:user)