diff options
author | lain <lain@soykaf.club> | 2020-05-25 17:27:45 +0200 |
---|---|---|
committer | lain <lain@soykaf.club> | 2020-05-25 17:27:45 +0200 |
commit | dbd07d29a358a446d87078d60b993a59b757ad1d (patch) | |
tree | 9c532e73ea5df103541ed37fff5a39ae41830ed3 /test | |
parent | 2c25087d20e3b90c39affc8d7ad2a15a860334b4 (diff) | |
download | pleroma-dbd07d29a358a446d87078d60b993a59b757ad1d.tar.gz |
Streamer: Don't crash on streaming chat notifications
Diffstat (limited to 'test')
-rw-r--r-- | test/web/streamer/streamer_test.exs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/test/web/streamer/streamer_test.exs b/test/web/streamer/streamer_test.exs index cb4595bb6..115ba4703 100644 --- a/test/web/streamer/streamer_test.exs +++ b/test/web/streamer/streamer_test.exs @@ -126,6 +126,21 @@ defmodule Pleroma.Web.StreamerTest do refute Streamer.filtered_by_user?(user, notify) end + test "it sends chat message notifications to the 'user:notification' stream", %{user: user} do + other_user = insert(:user) + + {:ok, create_activity} = CommonAPI.post_chat_message(other_user, user, "hey") + + notify = + Repo.get_by(Pleroma.Notification, user_id: user.id, activity_id: create_activity.id) + |> Repo.preload(:activity) + + Streamer.get_topic_and_add_socket("user:notification", user) + Streamer.stream("user:notification", notify) + assert_receive {:render_with_user, _, _, ^notify} + refute Streamer.filtered_by_user?(user, notify) + end + test "it doesn't send notify to the 'user:notification' stream when a user is blocked", %{ user: user } do |