diff options
author | Roman Chvanikov <chvanikoff@pm.me> | 2019-07-24 16:37:52 +0300 |
---|---|---|
committer | Roman Chvanikov <chvanikoff@pm.me> | 2019-07-24 16:37:52 +0300 |
commit | d2da3d30f3349946500423bab53e0c1221ab7b9b (patch) | |
tree | 338d2e3b0412a9be89a462173e367495c5e9ad40 /test/web/streamer_test.exs | |
parent | afc7708dbe00a70be616f00f01b22b0d01b9b61b (diff) | |
parent | 53fad36b57b61b28db595e445cd01fd6044dab6b (diff) | |
download | pleroma-d2da3d30f3349946500423bab53e0c1221ab7b9b.tar.gz pleroma-d2da3d30f3349946500423bab53e0c1221ab7b9b.zip |
Merge branch 'develop' into feature/digest-email
Diffstat (limited to 'test/web/streamer_test.exs')
-rw-r--r-- | test/web/streamer_test.exs | 57 |
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 |