forked from AkkomaGang/akkoma
Add test
This commit is contained in:
parent
600e2ea073
commit
570123ae21
1 changed files with 34 additions and 1 deletions
|
@ -574,7 +574,7 @@ test "doesn't return transitive interactions concerning blocked users" do
|
||||||
refute Enum.member?(activities, activity_four)
|
refute Enum.member?(activities, activity_four)
|
||||||
end
|
end
|
||||||
|
|
||||||
test "doesn't return announce activities concerning blocked users" do
|
test "doesn't return announce activities with blocked users in 'to'" do
|
||||||
blocker = insert(:user)
|
blocker = insert(:user)
|
||||||
blockee = insert(:user)
|
blockee = insert(:user)
|
||||||
friend = insert(:user)
|
friend = insert(:user)
|
||||||
|
@ -596,6 +596,39 @@ test "doesn't return announce activities concerning blocked users" do
|
||||||
refute Enum.member?(activities, activity_three.id)
|
refute Enum.member?(activities, activity_three.id)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
test "doesn't return announce activities with blocked users in 'cc'" do
|
||||||
|
blocker = insert(:user)
|
||||||
|
blockee = insert(:user)
|
||||||
|
friend = insert(:user)
|
||||||
|
|
||||||
|
{:ok, _user_relationship} = User.block(blocker, blockee)
|
||||||
|
|
||||||
|
{:ok, activity_one} = CommonAPI.post(friend, %{status: "hey!"})
|
||||||
|
|
||||||
|
{:ok, activity_two} = CommonAPI.post(blockee, %{status: "hey! @#{friend.nickname}"})
|
||||||
|
|
||||||
|
assert object = Pleroma.Object.normalize(activity_two)
|
||||||
|
|
||||||
|
data = %{
|
||||||
|
"actor" => friend.ap_id,
|
||||||
|
"object" => object.data["id"],
|
||||||
|
"context" => object.data["context"],
|
||||||
|
"type" => "Announce",
|
||||||
|
"to" => ["https://www.w3.org/ns/activitystreams#Public"],
|
||||||
|
"cc" => [blockee.ap_id]
|
||||||
|
}
|
||||||
|
|
||||||
|
assert {:ok, activity_three} = ActivityPub.insert(data)
|
||||||
|
|
||||||
|
activities =
|
||||||
|
ActivityPub.fetch_activities([], %{"blocking_user" => blocker})
|
||||||
|
|> Enum.map(fn act -> act.id end)
|
||||||
|
|
||||||
|
assert Enum.member?(activities, activity_one.id)
|
||||||
|
refute Enum.member?(activities, activity_two.id)
|
||||||
|
refute Enum.member?(activities, activity_three.id)
|
||||||
|
end
|
||||||
|
|
||||||
test "doesn't return activities from blocked domains" do
|
test "doesn't return activities from blocked domains" do
|
||||||
domain = "dogwhistle.zone"
|
domain = "dogwhistle.zone"
|
||||||
domain_user = insert(:user, %{ap_id: "https://#{domain}/@pundit"})
|
domain_user = insert(:user, %{ap_id: "https://#{domain}/@pundit"})
|
||||||
|
|
Loading…
Reference in a new issue