forked from mirrors/akkoma
Notifications: Use all recipients, not just "to".
This commit is contained in:
parent
01faa7c555
commit
6b32b9e346
|
@ -304,7 +304,7 @@ def update_follower_count(%User{} = user) do
|
||||||
update_and_set_cache(cs)
|
update_and_set_cache(cs)
|
||||||
end
|
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,
|
query = from u in User,
|
||||||
where: u.ap_id in ^to,
|
where: u.ap_id in ^to,
|
||||||
where: u.local == true
|
where: u.local == true
|
||||||
|
@ -312,7 +312,7 @@ def get_notified_from_activity(%Activity{data: %{"to" => to}}) do
|
||||||
Repo.all(query)
|
Repo.all(query)
|
||||||
end
|
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,
|
query = from u in User,
|
||||||
where: u.ap_id in ^to,
|
where: u.ap_id in ^to,
|
||||||
or_where: fragment("? \\\?| ?", u.following, ^to)
|
or_where: fragment("? \\\?| ?", u.following, ^to)
|
||||||
|
|
|
@ -25,6 +25,7 @@ def object(conn, %{"uuid" => uuid}) do
|
||||||
# TODO: Ensure that this inbox is a recipient of the message
|
# TODO: Ensure that this inbox is a recipient of the message
|
||||||
def inbox(%{assigns: %{valid_signature: true}} = conn, params) do
|
def inbox(%{assigns: %{valid_signature: true}} = conn, params) do
|
||||||
# File.write("/tmp/incoming.json", Poison.encode!(params))
|
# File.write("/tmp/incoming.json", Poison.encode!(params))
|
||||||
|
Logger.info(Poison.encode!(params, [pretty: 2]))
|
||||||
with {:ok, _user} <- ap_enabled_actor(params["actor"]),
|
with {:ok, _user} <- ap_enabled_actor(params["actor"]),
|
||||||
nil <- Activity.get_by_ap_id(params["id"]),
|
nil <- Activity.get_by_ap_id(params["id"]),
|
||||||
{:ok, activity} <- Transmogrifier.handle_incoming(params) do
|
{:ok, activity} <- Transmogrifier.handle_incoming(params) do
|
||||||
|
|
Loading…
Reference in a new issue