diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pleroma/activity.ex | 1 | ||||
-rw-r--r-- | lib/pleroma/web/activity_pub/activity_pub.ex | 7 |
2 files changed, 7 insertions, 1 deletions
diff --git a/lib/pleroma/activity.ex b/lib/pleroma/activity.ex index 2d4e9da0c..893a7536e 100644 --- a/lib/pleroma/activity.ex +++ b/lib/pleroma/activity.ex @@ -39,6 +39,7 @@ defmodule Pleroma.Activity do field(:local, :boolean, default: true) field(:actor, :string) field(:recipients, {:array, :string}, default: []) + field(:recipient_users, {:array, :string}, default: []) field(:thread_muted?, :boolean, virtual: true) # This is a fake relation, do not use outside of with_preloaded_bookmark/get_bookmark has_one(:bookmark, Bookmark) diff --git a/lib/pleroma/web/activity_pub/activity_pub.ex b/lib/pleroma/web/activity_pub/activity_pub.ex index ab29ee497..dba9560ab 100644 --- a/lib/pleroma/web/activity_pub/activity_pub.ex +++ b/lib/pleroma/web/activity_pub/activity_pub.ex @@ -61,6 +61,9 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do {recipients, to, cc} end + defp get_recipient_users(recipients), + do: Enum.filter(recipients, fn recipient -> !is_nil(User.get_cached_by_ap_id(recipient)) end) + defp check_actor_is_active(actor) do if not is_nil(actor) do with user <- User.get_cached_by_ap_id(actor), @@ -126,6 +129,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do {_, true} <- {:remote_limit_error, check_remote_limit(map)}, {:ok, map} <- MRF.filter(map), {recipients, _, _} = get_recipients(map), + recipient_users <- get_recipient_users(recipients), {:fake, false, map, recipients} <- {:fake, fake, map, recipients}, :ok <- Containment.contain_child(map), {:ok, map, object} <- insert_full_object(map) do @@ -134,7 +138,8 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do data: map, local: local, actor: map["actor"], - recipients: recipients + recipients: recipients, + recipient_users: recipient_users }) # Splice in the child object if we have one. |