From: eal Date: Mon, 20 Nov 2017 05:58:43 +0000 (+0200) Subject: Fix posts being streamed to non-local websocket channels. X-Git-Url: https://git.squeep.com/?a=commitdiff_plain;h=bd921ca5d7830efc9dde68b763412fdc03725adc;p=akkoma Fix posts being streamed to non-local websocket channels. --- diff --git a/lib/pleroma/user.ex b/lib/pleroma/user.ex index 59d4fb839..f80c0ae33 100644 --- a/lib/pleroma/user.ex +++ b/lib/pleroma/user.ex @@ -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 diff --git a/test/user_test.exs b/test/user_test.exs index c06663ed7..8ec23c751 100644 --- a/test/user_test.exs +++ b/test/user_test.exs @@ -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