Fix posts being streamed to non-local websocket channels.
authoreal <eal@waifu.club>
Mon, 20 Nov 2017 05:58:43 +0000 (07:58 +0200)
committereal <eal@waifu.club>
Mon, 20 Nov 2017 05:58:43 +0000 (07:58 +0200)
lib/pleroma/user.ex
test/user_test.exs

index 59d4fb839f4254eba5c039187871555b547e5d12..f80c0ae338f54f3ed4714f6d877bcb2846a7edfa 100644 (file)
@@ -286,12 +286,12 @@ defmodule Pleroma.User do
 
   def get_recipients_from_activity(%Activity{data: %{"to" => to}}) do
     query = from u in User,
-      where: u.local == true
-
-    query = from u in query,
       where: u.ap_id in ^to,
       or_where: fragment("? \\\?| ?", u.following, ^to)
 
+    query = from u in query,
+      where: u.local == true
+
     Repo.all(query)
   end
 
index c06663ed7ced4c417754f104c16eb36fd4171858..8ec23c7514ab0c62d392ec28eec88c77829743a5 100644 (file)
@@ -318,6 +318,7 @@ defmodule Pleroma.UserTest do
     assert [addressed] == User.get_recipients_from_activity(activity)
 
     {:ok, user} = User.follow(user, actor)
+    {:ok, user_two} = User.follow(user_two, actor)
     recipients = User.get_recipients_from_activity(activity)
     assert length(recipients) == 2
     assert user in recipients