summaryrefslogtreecommitdiff
path: root/test/web/streamer_test.exs
diff options
context:
space:
mode:
authorrinpatch <rinpatch@sdf.org>2019-07-25 18:43:30 +0300
committerrinpatch <rinpatch@sdf.org>2019-07-25 18:43:30 +0300
commit41e0304757c5a0d9778f7e685c9ddf481f0e15cb (patch)
treedc60d86d41153d9764cb32a9adae5fa24894c1fa /test/web/streamer_test.exs
parent196cad46f35a63c18d58cd5d982bc4e1f9b0d7c3 (diff)
parentd1e891062e3c6c34ca7940a476917beea2822ca2 (diff)
downloadpleroma-41e0304757c5a0d9778f7e685c9ddf481f0e15cb.tar.gz
pleroma-41e0304757c5a0d9778f7e685c9ddf481f0e15cb.zip
Merge branch 'develop' into feature/hide-follows-remote
Diffstat (limited to 'test/web/streamer_test.exs')
-rw-r--r--test/web/streamer_test.exs57
1 files changed, 57 insertions, 0 deletions
diff --git a/test/web/streamer_test.exs b/test/web/streamer_test.exs
index 4633d7765..d47b37efb 100644
--- a/test/web/streamer_test.exs
+++ b/test/web/streamer_test.exs
@@ -65,6 +65,63 @@ defmodule Pleroma.Web.StreamerTest do
Streamer.stream("user:notification", notify)
Task.await(task)
end
+
+ test "it doesn't send notify to the 'user:notification' stream when a user is blocked", %{
+ user: user
+ } do
+ blocked = insert(:user)
+ {:ok, user} = User.block(user, blocked)
+
+ task = Task.async(fn -> refute_receive {:text, _}, 4_000 end)
+
+ Streamer.add_socket(
+ "user:notification",
+ %{transport_pid: task.pid, assigns: %{user: user}}
+ )
+
+ {:ok, activity} = CommonAPI.post(user, %{"status" => ":("})
+ {:ok, notif, _} = CommonAPI.favorite(activity.id, blocked)
+
+ Streamer.stream("user:notification", notif)
+ Task.await(task)
+ end
+
+ test "it doesn't send notify to the 'user:notification' stream when a thread is muted", %{
+ user: user
+ } do
+ user2 = insert(:user)
+ task = Task.async(fn -> refute_receive {:text, _}, 4_000 end)
+
+ Streamer.add_socket(
+ "user:notification",
+ %{transport_pid: task.pid, assigns: %{user: user}}
+ )
+
+ {:ok, activity} = CommonAPI.post(user, %{"status" => "super hot take"})
+ {:ok, activity} = CommonAPI.add_mute(user, activity)
+ {:ok, notif, _} = CommonAPI.favorite(activity.id, user2)
+ Streamer.stream("user:notification", notif)
+ Task.await(task)
+ end
+
+ test "it doesn't send notify to the 'user:notification' stream' when a domain is blocked", %{
+ user: user
+ } do
+ user2 = insert(:user, %{ap_id: "https://hecking-lewd-place.com/user/meanie"})
+ task = Task.async(fn -> refute_receive {:text, _}, 4_000 end)
+
+ Streamer.add_socket(
+ "user:notification",
+ %{transport_pid: task.pid, assigns: %{user: user}}
+ )
+
+ {:ok, user} = User.block_domain(user, "hecking-lewd-place.com")
+ {:ok, activity} = CommonAPI.post(user, %{"status" => "super hot take"})
+ {:ok, notif, _} = CommonAPI.favorite(activity.id, user2)
+
+ Streamer.stream("user:notification", notif)
+ Task.await(task)
+ end
end
test "it sends to public" do