diff options
author | Ariadne Conill <ariadne@dereferenced.org> | 2019-11-03 09:05:12 -0600 |
---|---|---|
committer | lain <lain@soykaf.club> | 2019-11-04 16:25:05 +0100 |
commit | 6a151e7c7f90b0aea71580e613be4ddf5a4809f5 (patch) | |
tree | 722588a407516e7dbdbc63d2c9235360929c15eb /test | |
parent | 5f844fd3f2b35075bd3a90c71315c321fec6a6e8 (diff) | |
download | pleroma-6a151e7c7f90b0aea71580e613be4ddf5a4809f5.tar.gz |
streamer: use direct object for filter checks when there is no valid child object in an activity
We call Object.normalize/1 to get the child object for situations like Announce.
However, the check is flawed and immediately fails if Object.normalize/1 fails.
Instead, we should use the activity itself in those cases to allow activities which
never have a child object to pass through the filter.
Closes #1291
Diffstat (limited to 'test')
-rw-r--r-- | test/web/streamer/streamer_test.exs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/web/streamer/streamer_test.exs b/test/web/streamer/streamer_test.exs index 313567bfd..601f6df49 100644 --- a/test/web/streamer/streamer_test.exs +++ b/test/web/streamer/streamer_test.exs @@ -110,6 +110,24 @@ defmodule Pleroma.Web.StreamerTest do Streamer.stream("user:notification", notif) Task.await(task) end + + test "it sends follow activities to the 'user:notification' stream", %{ + user: user + } do + user2 = insert(:user) + task = Task.async(fn -> assert_receive {:text, _}, 4_000 end) + + Streamer.add_socket( + "user:notification", + %{transport_pid: task.pid, assigns: %{user: user}} + ) + + {:ok, _follower, _followed, _activity} = CommonAPI.follow(user2, user) + + # We don't directly pipe the notification to the streamer as it's already + # generated as a side effect of CommonAPI.follow(). + Task.await(task) + end end test "it sends to public" do |