blocked = insert(:user)
{:ok, user} = User.block(user, blocked)
+ {:ok, activity} = CommonAPI.post(user, %{"status" => ":("})
+ {:ok, notif, _} = CommonAPI.favorite(activity.id, blocked)
+
task = Task.async(fn -> refute_receive {:text, _}, 4_000 end)
Streamer.add_socket(
%{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
user: user
} do
user2 = insert(:user)
+
+ {:ok, activity} = CommonAPI.post(user, %{"status" => "super hot take"})
+ {:ok, activity} = CommonAPI.add_mute(user, activity)
+ {:ok, notif, _} = CommonAPI.favorite(activity.id, user2)
+
task = Task.async(fn -> refute_receive {:text, _}, 4_000 end)
Streamer.add_socket(
%{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
user: user
} do
user2 = insert(:user, %{ap_id: "https://hecking-lewd-place.com/user/meanie"})
+
+ {: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)
+
task = Task.async(fn -> refute_receive {:text, _}, 4_000 end)
Streamer.add_socket(
%{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
blocked_user = insert(:user)
{:ok, user} = User.block(user, blocked_user)
+ {:ok, activity} = CommonAPI.post(blocked_user, %{"status" => "Test"})
+
task =
Task.async(fn ->
refute_receive {:text, _}, 1_000
user: user
}
- {:ok, activity} = CommonAPI.post(blocked_user, %{"status" => "Test"})
-
topics = %{
"public" => [fake_socket]
}
{:ok, list} = List.create("Test", user_a)
{:ok, list} = List.follow(list, user_b)
+ {:ok, activity} =
+ CommonAPI.post(user_b, %{
+ "status" => "@#{user_c.nickname} Test",
+ "visibility" => "direct"
+ })
+
task =
Task.async(fn ->
refute_receive {:text, _}, 1_000
user: user_a
}
- {:ok, activity} =
- CommonAPI.post(user_b, %{
- "status" => "@#{user_c.nickname} Test",
- "visibility" => "direct"
- })
-
topics = %{
"list:#{list.id}" => [fake_socket]
}
{:ok, list} = List.create("Test", user_a)
{:ok, list} = List.follow(list, user_b)
+ {:ok, activity} =
+ CommonAPI.post(user_b, %{
+ "status" => "Test",
+ "visibility" => "private"
+ })
+
task =
Task.async(fn ->
refute_receive {:text, _}, 1_000
user: user_a
}
- {:ok, activity} =
- CommonAPI.post(user_b, %{
- "status" => "Test",
- "visibility" => "private"
- })
-
topics = %{
"list:#{list.id}" => [fake_socket]
}
{:ok, list} = List.create("Test", user_a)
{:ok, list} = List.follow(list, user_b)
+ {:ok, activity} =
+ CommonAPI.post(user_b, %{
+ "status" => "Test",
+ "visibility" => "private"
+ })
+
task =
Task.async(fn ->
assert_receive {:text, _}, 1_000
user: user_a
}
- {:ok, activity} =
- CommonAPI.post(user_b, %{
- "status" => "Test",
- "visibility" => "private"
- })
-
Streamer.add_socket(
"list:#{list.id}",
fake_socket
user3 = insert(:user)
CommonAPI.hide_reblogs(user1, user2)
+ {:ok, create_activity} = CommonAPI.post(user3, %{"status" => "I'm kawen"})
+ {:ok, announce_activity, _} = CommonAPI.repeat(create_activity.id, user2)
+
task =
Task.async(fn ->
refute_receive {:text, _}, 1_000
user: user1
}
+ topics = %{
+ "public" => [fake_socket]
+ }
+
+ Worker.push_to_socket(topics, "public", announce_activity)
+
+ Task.await(task)
+ end
+
+ test "it does send non-reblog notification for reblog-muted actors" do
+ user1 = insert(:user)
+ user2 = insert(:user)
+ user3 = insert(:user)
+ CommonAPI.hide_reblogs(user1, user2)
+
{:ok, create_activity} = CommonAPI.post(user3, %{"status" => "I'm kawen"})
- {:ok, announce_activity, _} = CommonAPI.repeat(create_activity.id, user2)
+ {:ok, favorite_activity, _} = CommonAPI.favorite(create_activity.id, user2)
+
+ task =
+ Task.async(fn ->
+ assert_receive {:text, _}, 1_000
+ end)
+
+ fake_socket = %StreamerSocket{
+ transport_pid: task.pid,
+ user: user1
+ }
topics = %{
"public" => [fake_socket]
}
- Worker.push_to_socket(topics, "public", announce_activity)
+ Worker.push_to_socket(topics, "public", favorite_activity)
Task.await(task)
end