activitypub: dont include the actor on the recipient_users list
This commit is contained in:
parent
dd904ab8fa
commit
4e412a705a
@ -61,8 +61,11 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
|
|||||||
{recipients, to, cc}
|
{recipients, to, cc}
|
||||||
end
|
end
|
||||||
|
|
||||||
defp get_recipient_users(recipients),
|
defp get_recipient_users(recipients, actor),
|
||||||
do: Enum.filter(recipients, fn recipient -> !is_nil(User.get_cached_by_ap_id(recipient)) end)
|
do:
|
||||||
|
Enum.filter(recipients, fn recipient ->
|
||||||
|
actor != recipient && !is_nil(User.get_cached_by_ap_id(recipient))
|
||||||
|
end)
|
||||||
|
|
||||||
defp check_actor_is_active(actor) do
|
defp check_actor_is_active(actor) do
|
||||||
if not is_nil(actor) do
|
if not is_nil(actor) do
|
||||||
@ -129,7 +132,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
|
|||||||
{_, true} <- {:remote_limit_error, check_remote_limit(map)},
|
{_, true} <- {:remote_limit_error, check_remote_limit(map)},
|
||||||
{:ok, map} <- MRF.filter(map),
|
{:ok, map} <- MRF.filter(map),
|
||||||
{recipients, _, _} = get_recipients(map),
|
{recipients, _, _} = get_recipients(map),
|
||||||
recipient_users <- get_recipient_users(recipients),
|
recipient_users <- get_recipient_users(recipients, map["actor"]),
|
||||||
{:fake, false, map, recipients} <- {:fake, fake, map, recipients},
|
{:fake, false, map, recipients} <- {:fake, fake, map, recipients},
|
||||||
:ok <- Containment.contain_child(map),
|
:ok <- Containment.contain_child(map),
|
||||||
{:ok, map, object} <- insert_full_object(map) do
|
{:ok, map, object} <- insert_full_object(map) do
|
||||||
@ -718,12 +721,14 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
|
|||||||
[activity, object] in query,
|
[activity, object] in query,
|
||||||
where:
|
where:
|
||||||
fragment(
|
fragment(
|
||||||
"? && ? and (?->>'inReplyTo' is null or ? <@ ?)",
|
"? && ? and (?->>'inReplyTo' is null or ? && ? or ? = ?)",
|
||||||
^recipients,
|
^recipients,
|
||||||
activity.recipients,
|
activity.recipients,
|
||||||
object.data,
|
object.data,
|
||||||
activity.recipient_users,
|
activity.recipient_users,
|
||||||
^reply_recipients
|
^reply_recipients,
|
||||||
|
activity.actor,
|
||||||
|
^user.ap_id
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
@ -739,14 +744,16 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
|
|||||||
[activity, object] in query,
|
[activity, object] in query,
|
||||||
where:
|
where:
|
||||||
fragment(
|
fragment(
|
||||||
"? && ? and (?->>'inReplyTo' is null or ? && ? or ? <@ ?)",
|
"? && ? and (?->>'inReplyTo' is null or ? && ? or ? && ? or ? = ?)",
|
||||||
^recipients,
|
^recipients,
|
||||||
activity.recipients,
|
activity.recipients,
|
||||||
object.data,
|
object.data,
|
||||||
activity.recipients,
|
activity.recipients,
|
||||||
^public_recipients,
|
^public_recipients,
|
||||||
activity.recipient_users,
|
activity.recipient_users,
|
||||||
^reply_recipients
|
^reply_recipients,
|
||||||
|
activity.actor,
|
||||||
|
^user.ap_id
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user