From 6b32b9e3466016f457fd257e7cc18d85fa075a93 Mon Sep 17 00:00:00 2001 From: lain Date: Mon, 19 Feb 2018 10:05:26 +0100 Subject: [PATCH] Notifications: Use all recipients, not just "to". --- lib/pleroma/user.ex | 4 ++-- lib/pleroma/web/activity_pub/activity_pub_controller.ex | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/pleroma/user.ex b/lib/pleroma/user.ex index f88c1240a..bc7f2601f 100644 --- a/lib/pleroma/user.ex +++ b/lib/pleroma/user.ex @@ -304,7 +304,7 @@ defmodule Pleroma.User do update_and_set_cache(cs) end - def get_notified_from_activity(%Activity{data: %{"to" => to}}) do + def get_notified_from_activity(%Activity{recipients: to}) do query = from u in User, where: u.ap_id in ^to, where: u.local == true @@ -312,7 +312,7 @@ defmodule Pleroma.User do Repo.all(query) end - def get_recipients_from_activity(%Activity{data: %{"to" => to}}) do + def get_recipients_from_activity(%Activity{recipients: to}) do query = from u in User, where: u.ap_id in ^to, or_where: fragment("? \\\?| ?", u.following, ^to) diff --git a/lib/pleroma/web/activity_pub/activity_pub_controller.ex b/lib/pleroma/web/activity_pub/activity_pub_controller.ex index 8ba15d73e..1a6d7ec7a 100644 --- a/lib/pleroma/web/activity_pub/activity_pub_controller.ex +++ b/lib/pleroma/web/activity_pub/activity_pub_controller.ex @@ -25,6 +25,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubController do # TODO: Ensure that this inbox is a recipient of the message def inbox(%{assigns: %{valid_signature: true}} = conn, params) do # File.write("/tmp/incoming.json", Poison.encode!(params)) + Logger.info(Poison.encode!(params, [pretty: 2])) with {:ok, _user} <- ap_enabled_actor(params["actor"]), nil <- Activity.get_by_ap_id(params["id"]), {:ok, activity} <- Transmogrifier.handle_incoming(params) do